在创建存储过程处理数据的时候,EXECUTE IMMEDIATE中的引号需要进行转义。
create or replace procedure p_archive
as
execute immediate 'create table t as select 'system' from t ';
end ;
以上在执行的时候会出错,正确的做法如下:
create or replace procedure p_archive
as
execute immediate 'create table t as select ''system'' from t ';
end ;