Home » Developer & Programmer » Forms » Problem while executing the delete statement in the Procedure (Oracle 9i)
Problem while executing the delete statement in the Procedure [message #336841] Tue, 29 July 2008 03:29 Go to next message
sen_careers@yahoo.co.in
Messages: 4
Registered: July 2008
Location: India
Junior Member
Hi Experts,

Please verify the procedure below .....

create or replace procedure senthiltest
is
table_name varchar2(30);
cursor senthil1 is
select tname from tab;
BEGIN
open senthil1;
LOOP
fetch senthil1 into table_name;
delete from table_name; //this statement is not working
exit when senthil1%notfound;
DBMS_OUTPUT.PUT_LINE('Deleted Table :'||table_name);
END LOOP;
close senthil1;
END;


In this procedure the Delete statement is not working saying that table_name is an invalid table name. (i.e) The variable table_name is not known for the delete statement.

How can I delete all the table that are created by me by running one single procedure like this ???.....


Thanks in advance,
Senthilkumar.Parthiban
Re: Problem while executing the delete statement in the Procedure [message #336874 is a reply to message #336841] Tue, 29 July 2008 04:46 Go to previous messageGo to next message
Littlefoot
Messages: 20897
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It required dynamic SQL (search for EXECUTE IMMEDIATE).

As you've decided to ask this question in the Forms forum, relatively bad news for you: EXECUTE IMMEDIATE can not be used in Forms. However, you may put this procedure into the database (so that it would be a "stored procedure") and call it from the form.
Re: Problem while executing the delete statement in the Procedure [message #336947 is a reply to message #336841] Tue, 29 July 2008 07:37 Go to previous message
sen_careers@yahoo.co.in
Messages: 4
Registered: July 2008
Location: India
Junior Member
Thanks alot it worked successfully.
I drop all the tables successfully.
Thanks alot liitlefoot
Previous Topic: List of values
Next Topic: Accesing Forms 6i on the web
Goto Forum:
  


Current Time: Wed Dec 07 12:27:13 CST 2016

Total time taken to generate the page: 0.13399 seconds