Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Creating table with EXECUTE immediate

MansiRavalJan 31 2018 — edited Feb 5 2018

Hello Experts,

I am trying to create table at runtime using  EXECUTE immediate in anonymous block. I am passing table name as parameter in block. Please find below piece of code,

It continuously giving error and not allowing to create table runtime.

Declare

Operation number  := &1;

sqlstring varchar2(1000);

BEGIN

sqlstring:= 'Create table ' || &2 ||

' as SELECT Order_ID,'||

'group_id,'||

'FROM Transaction_table';

EXECUTE IMMEDIATE sqlstring;

End;

I am calling this block using this argument;

@/tmp/Createtable.sql 1 Order_table;

also tried this

@/tmp/Createtable.sql 1 'Order_table';

But both giving same error.

ORA-06550: line 4, column 34:

PLS-00201: identifier 'Order_table' must be declared

Help on this please.

This post has been answered by GregV on Jan 31 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 1 2018
Added on Jan 31 2018
20 comments
1,448 views