I want to create a table inside of a procedure. I tried to put the create query in a string then execute immediate the string. For example:
create or replace procedure hr.temp is
var1 varchar2(4000);
begin
var1:='create table hr.temp(
id number)';
execute immediate var1;
end temp;
But when I execute this procedure I get the error:
ORA-00911: invalid character
ORA-06512: at "SYS.TEMP", line 6
.
.
.
Is there any way I can do this?
;
character. Execute immediate can execute only a single statement anyway, so no termination character is required);
character,now when i execute the procedure,it begin but never end,it's like procedure is in the loop that never end!;
. Btw: you can't create a table with the same name as an existing procedure. But apart from that this should work fine: sqlfiddle.com/#!4/37847/2temp2
?