我有一个小的pl/sql过程,我试图在12c中运行,代码如下:
create or replace procedure p_ins_tbl(tbl_name in varchar2) as
begin
execute immediate 'insert into ' ||tbl_name|| 'values(121,''asdfasdf'',6)' ;
end p_ins_tbl;
编译成功,
,当我试图执行:exec p_ins_tbl(countries);
我得到的错误是:
Error starting at line 6 in command:
exec p_ins_tbl(countries)
Error report:
ORA-06550: line 1, column 17:
PLS-00357: Table,View Or Sequence reference 'COUNTRIES' not allowed in this context
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
为什么我得到这个?如果有什么问题,请纠正我,谢谢。
试试这个:
execute p_ins_tbl('countries');