dynamic SQL not working as expected

Posted by christine33990 on Stack Overflow See other posts from Stack Overflow or by christine33990
Published on 2010-04-06T08:27:19Z Indexed on 2010/04/06 8:33 UTC
Read the original article Hit count: 162

Filed under:
|
create or replace procedure createtables
  Authid current_user as
begin
  execute immediate 'create table newcustomer as select * from customer';
end;

create or replace procedure e
is
begin
 createtables;
 select * from newcustomer; 
end;

I got two procedures above. first one will create a new tables called newcustomer, second procedure will call the first procedure and query to the newcustomer table. when I try to compile this code, it says the table is not yet created, I don't really get it as I have called createtables procedure so I assume I have created the table.

Any help will be appreciated. Thanks

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle