parameter in SQL command [message #10097] |
Mon, 05 January 2004 09:44 |
Deb
Messages: 17 Registered: November 2001
|
Junior Member |
|
|
Does any one know how to pass a parameter to a SQL cmd.
For example, I wanna do this.
SELECT table_name INTO a_tab FROM dba_tables WHERE ........
Now I want to alter the table in a_tab using
ALTER TABLE 'table_name' command. How do I substitute the 'table_name' in the ALTER TABLE command with my a_tab?
Any inputs will be greatly appreciated.
Thx
|
|
|
Re: parameter in SQL command [message #10098 is a reply to message #10097] |
Mon, 05 January 2004 09:50 |
sverch
Messages: 582 Registered: December 2000
|
Senior Member |
|
|
declare
a_tab varchar2(10);
begin
select table_name into a_tab from USER_tables where table_name='T1';
EXECUTE IMMEDIATE 'TRUNCATE TABLE '||a_tab;
END;
|
|
|