我正在尝试在主存储过程中执行^存储过程。但它不起作用。
错误(11,9):PLS-00103:遇到以下其中一项时遇到符号“FN_UPD”:: =。 (@%;符号“:=”代替“FN_UPD”继续。
代码:
create or replace
procedure FN_READ
is
cursor C_1 is select distinct(COLUMN1) from TB_SOURCE;
cursor C_2 is select distinct(COLUMN2) from TB_SOURCE;
cursor C_3 is select distinct(COLUMN3) from TB_SOURCE;
BEGIN
for f in C_1
LOOP
EXEC FN_UPD('A', 'A');
end LOOP;
for f in C_2
LOOP
EXEC PROCEDURE FN_UPD(f.COLUMN2, 'M')
end LOOP;
for f in C_3
LOOP
EXEC FN_UPD(f.COLUMN3, 'O')
end LOOP;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
END;
答案 0 :(得分:2)
EXEC
(同样适用于EXEC PROCEDURE
)在PL / SQL中不起作用,直接使用过程名称:
BEGIN
FN_UPD('A', 'A');
END;
/
答案 1 :(得分:1)
替换
EXEC FN_UPD(f.COLUMN3, 'O')
和
EXEC PROCEDURE FN_UPD(f.COLUMN2, 'M')
与
FN_UPD(f.COLUMN3, 'O');
和
FN_UPD(f.COLUMN2, 'M');
分别
请注意尾随;
。
所以,你的程序变成了
create or replace
procedure FN_READ
is
cursor C_1 is select distinct(COLUMN1) from TB_SOURCE;
cursor C_2 is select distinct(COLUMN2) from TB_SOURCE;
cursor C_3 is select distinct(COLUMN3) from TB_SOURCE;
BEGIN
for f in C_1 LOOP
FN_UPD('A', 'A');
end LOOP;
for f in C_2 LOOP
FN_UPD(f.COLUMN2, 'M')
end LOOP;
for f in C_3 LOOP
FN_UPD(f.COLUMN3, 'O')
end LOOP;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
END;