编译此函数时收到以下错误:
PROCEDURE HAR.REPORT_INCOME_PROC PLS-00103的编译错误: 遇到以下情况之一时遇到符号“”
我已经尝试过用Google搜索它,但是我不能错...
CREATE OR REPLACE PROCEDURE REPORT_INCOME_PROC IS
BEGIN
DELETE FROM HAR.REPORT_INCOME;
INSERT INTO HAR.REPORT_INCOME RI
(RI.INCOME,
RI.AREA,
RI.INCOME_TYPE,
RI.DATA_DATE,
RI.CREATE_DATE,
RI.UPDATE_DATE)
SELECT SUM(YD.HJJE) DRSR,
MDYS.JYDQ SYB,
1,
TRUNC(YD.KDSJ) RQ,
(select sysdate from dual) XZSJ,
(select sysdate from dual) XGSJ
FROM HYDATA.LD_YD YD
LEFT JOIN HYDATA.LD_KHXX KHXX
ON YD.TYRBH = KHXX.KHBH
LEFT JOIN HYDATA.LD_GS GS
ON YD.QYDZBH = GS.GSBH
LEFT JOIN HAR.REPORT_JY_MDYS MDYS
ON YD.QYDZBH = MDYS.GSBH
WHERE YD.KDSJ >= TRUNC(ADD_MONTHS(SYSDATE, -12), 'yy')
AND (YD.YDZT != 5)
AND (YD.CYRQZ != '20000000000000000001' OR YD.CYRQZ IS NULL)
AND (KHXX.KHLB != 4 OR KHXX.KHLB IS NULL)
AND (GS.GSJC NOT LIKE '%F%' OR GS.GSJC IS NULL)
GROUP BY TRUNC(YD.KDSJ), MDYS.JYDQ
ORDER BY MDYS.JYDQ ASC, TRUNC(YD.KDSJ) DESC;
COMMIT;
END;
这是错误
Error: PLS-00103: Encountered the symbol "" when expecting one of the following: begin function package pragma procedure subtype type use <an identifier> <a double-quoted delimited-identifier> form current cursor external language Line: 1
答案 0 :(得分:0)
嗨,我相信您在执行DML语句时需要在PLSQL BLOCK上使用EXECUTE IMMEDIATE。
尝试一下:
CREATE OR REPLACE PROCEDURE REPORT_INCOME_PROC IS
BEGIN
EXECUTE IMMEDIATE 'DELETE FROM HAR.REPORT_INCOME';
EXECUTE IMMEDIATE 'INSERT INTO HAR.REPORT_INCOME RI <the rest of your codes>';
END;