Home » SQL & PL/SQL » SQL & PL/SQL » Creation of Temp table
Creation of Temp table [message #21752] Wed, 28 August 2002 03:10 Go to next message
mani
Messages: 105
Registered: September 1999
Senior Member
Hi,
I have one procedure which accepts table name as parameter.
inside that procedure,i have to create the table with name as the passed parameter appended with temp_.
for ex.if the parameter value is 'TTA',then my temp table will be TEMP_TTA.

And here am doing some insertion and updation in that table.finally am dropping that table inside the proc itself.

For ex.I need something like below:
procedure proc1 (table_name IN varchar2(3))
is
create table temp_table_name
as
select * from table_name;
insert into temp_table_name(.........)

<<my update statements>>

drop temp_table_name:

any idea of doing this???
Thanks
Victoria
Re: Creation of Temp table [message #21775 is a reply to message #21752] Wed, 28 August 2002 22:25 Go to previous message
Ritika
Messages: 1
Registered: August 2002
Junior Member
create or replace procedure p1 (tab_name in varchar2)is sql_statment varchar2(1000);
begin sql_statment := 'create table '||tab_name|| ' as select * from r_cust;';
execute immediate sql_statment;
end;

Hope this helps you.
Previous Topic: Last successful action using one query
Next Topic: Using DECODE function in UPDATE statement
Goto Forum:
  


Current Time: Fri Apr 26 22:24:10 CDT 2024