Dynamic creation of Table using triggers. [message #1835] |
Mon, 03 June 2002 21:03 |
Vinu Menon
Messages: 1 Registered: June 2002
|
Junior Member |
|
|
Hi !
I've create a table named "A" with 4 fields viz. ID, Name, Age and Sex.
Now , I want to create a trigger on this table, which should fire the following event :-
After a new record is inserted in to the table, the trigger should automatically create a new table by the name entered in the Name field by the user.
For example, if I enter "VINU" in the Name field, then
the trigger should automatically create a new table by the name VINU with some fields.
I would be really greatful, if you could provide a soulution for the aforesaid problem.
Thanks and regards
Vinu Menon
|
|
|
|
Re: Dynamic creation of Table using triggers. [message #1854 is a reply to message #1835] |
Tue, 04 June 2002 23:22 |
JoJo
Messages: 18 Registered: January 2002
|
Junior Member |
|
|
And if you use oracle version prior to 8i ,you can use:
declare
cur integer;
rc integer;
BEGIN
cur := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(cur, 'create TABLE table_test(id number )', DBMS_SQL.NATIVE);
rc := DBMS_SQL.EXECUTE(cur);
DBMS_SQL.CLOSE_CURSOR(cur);
END;
I found it in the PL/SQL FAQ of this site,it is full of great info.
|
|
|