Friday, February 10, 2012

Creating Table dynamically in Oracle Procedure

November 5, 2009 by · Leave a Comment 

How can we create a table inside an Oracle procedure.

"CREATE TABLE tableName AS". We cannot execute this statement in procedures because upon creation of procedure it would give syntax error.

We can implement this with the help of EXECUTE IMMEDIATE command and then dynamically create table.

create or replace procedure Proc1 as
begin
execute immediate ‘create table NewTable(column1 integer )’;
end ;

Top Blogs

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

*