Oracle PL/SQL程序设计(第2版)
发布网友
发布时间:2022-04-24 04:18
我来回答
共1个回答
热心网友
时间:2022-04-07 23:30
CREATE OR REPLACE PROCEDURE "TEST"."PROC_INSMONTH_JL" AS
STRDATE1 VARCHAR2(50);
stryear VARCHAR2(10);
MYSTR VARCHAR2(2000);
BEGIN
STRDATE1:=TO_CHAR(SYSDATE,'YYYY-MM-DD');
stryear:=TO_CHAR(SYSDATE,'YYYYMM');
MYSTR:='INSERT INTO Report_Month_JL'||stryear||
' SELECT SID,PID,sum(newvalue) as Rvalue,sum(newvalue) as Newvalue,||STRDATE1|| as Ddate'||
' FROM REPORT_JL'||stryear||
' WHERE (PTIME BETWEEN SYSDATE-1 and SYSDATE)'||
' GROUP BY SI6D,PID';
EXECUTE IMMEDIATE MYSTR;
COMMIT;
---EXCEPTION
--- WHEN OTHERS THEN
---NULL;
END;