create or replace procedure getdefault isbegin
create global temporary table deftemp(pid varchar2(5))on commit delete rows
select * from deftemp;
end;报错:PLS-001103:Encountered the symbol "CREATE" when expecting on fo the following:
begin case declare exit for goto if loop mod null pragma raise return select update while with<an identirier>
create global temporary table deftemp(pid varchar2(5))on commit delete rows
select * from deftemp;
end;报错:PLS-001103:Encountered the symbol "CREATE" when expecting on fo the following:
begin case declare exit for goto if loop mod null pragma raise return select update while with<an identirier>
execute immediate 'create global temporary table deftemp(pid varchar2(5))on commit delete rows';
-- select * from deftemp; 不能直接select,需要用游标
end;
1、每个语句结束后用;
2、DDL需要用execute immediate动态的sql执行
3、存储过程不支持直接select,需要用游标
create or replace procedure getdefault(
iocur OUT sys_refCursor
)is
begin
execute immediate 'create global temporary table deftemp(pid varchar2(5))on commit delete rows';
OPEN ioCur FOR 'select * from deftemp';
exception
when others then
rollback;
end;