Home » SQL & PL/SQL » SQL & PL/SQL » how can i dynamic create a table?urgent!
how can i dynamic create a table?urgent! [message #36390] Sat, 24 November 2001 16:57 Go to next message
findren
Messages: 2
Registered: November 2001
Junior Member
hi,all friends!
i encounter a problem in my work,i must dynamic create a table and the table column must depend on the input parameters from another index table,urgent!
can i using dynamic dbms_sql?
how can i do this?
thanks!

----------------------------------------------------------------------
Re: how can i dynamic create a table?urgent! [message #36439 is a reply to message #36390] Wed, 28 November 2001 00:19 Go to previous messageGo to next message
tinel
Messages: 42
Registered: November 2001
Member
use dynamic sql like this:

create or replace procedure create_table_dynamic
is
Table_num VARCHAR2(20);
Table_col VARCHAR2(20);
BEGIN
table_num := 'testing_ddl';
table_col := 'name';
execute immediate 'create table ' || Table_num || '(' || table_col || ' varchar2(10))';
end;

where you can pass table_num and table_col as a procedure parameter, if you like you can pass even column datatype as a parameter

----------------------------------------------------------------------
Re: how can i dynamic create a table?urgent! [message #37483 is a reply to message #36439] Mon, 11 February 2002 16:23 Go to previous message
diaz
Messages: 58
Registered: October 2001
Member
i still don't understand how this 'execute immediate' works... and how are the results gonna be shown ?? well, i'm familiar of using cursors so when i wanted to show the results i just do the loop for the cursor and display them..
now with the 'execute immediate' how it's gonna be then ?????
Previous Topic: How to use Bulk Bind
Next Topic: How can I dump all table ,storeprocedure,view's schema
Goto Forum:
  


Current Time: Fri Apr 19 03:31:00 CDT 2024