Home » Developer & Programmer » Forms » The code work in database not in forms ... why?
icon5.gif  The code work in database not in forms ... why? [message #278798] Mon, 05 November 2007 12:43 Go to next message
Hany Freedom
Messages: 256
Registered: May 2007
Location: Egypt
Senior Member

I make this success code in database ( that code can remove all your tables from your schema permanently ).... that's the code:-

SQL> select*from cat;

TABLE_NAME                     TABLE_TYPE
------------------------------ -----------
J                              	TABLE
K                              	TABLE
U                              	TABLE
O                              	TABLE


SQL> create or replace PROCEDURE DROP_TABLES IS
  2  v_statement   VARCHAR2 (200);
  3  cursor cr is  select TABLE_NAME from user_tables;
  4  BEGIN
  5       FOR i IN cr
  6     LOOP
  7        v_statement :=
  8                  'drop table ' || i.TABLE_NAME || ' cascade constraints purge';
  9        EXECUTE IMMEDIATE v_statement;
 10     END LOOP;
 11  END;
 12  /
Procedure created.

SQL> exec DROP_TABLES
PL/SQL procedure successfully completed.


SQL>  select*from cat;
no rows selected


but when I made this procedure in the forms in program units give me this error :-
http://imgbolt.com/public/38840/forum.PNG
so ... what's the solve ?

note that the form attached here .... to test it by your self.
Re: The code work in database not in forms ... why? [message #278799 is a reply to message #278798] Mon, 05 November 2007 12:53 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
What is the version of forms?
If it is 6i, it supports oracle 8 only. EXECUTE IMMEDIATE has been introduced in 9i. You can use dbms_sql.

By
Vamsi

[Updated on: Mon, 05 November 2007 12:58]

Report message to a moderator

Re: The code work in database not in forms ... why? [message #278801 is a reply to message #278798] Mon, 05 November 2007 13:30 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As far as I can tell, EXECUTE IMMEDIATE can not be used in any version of Oracle Forms. I don't know what Forms 6i say, but 10g would inform you that this feature is not supported in client-side programs.

If you insist on doing something like this through Forms, use FORMS_DDL built-in instead.
Re: The code work in database not in forms ... why? [message #278814 is a reply to message #278801] Mon, 05 November 2007 15:07 Go to previous messageGo to next message
Hany Freedom
Messages: 256
Registered: May 2007
Location: Egypt
Senior Member

Littlefoot wrote on Mon, 05 November 2007 21:30


use FORMS_DDL built-in instead.


FORMS_DDL working good ..... thanks Smile
Re: The code work in database not in forms ... why? [message #279394 is a reply to message #278814] Thu, 08 November 2007 01:35 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Just a word of advice: be very very careful when using dynamic SQL. I know some of the people here get a kick out of it but if you can avoid it: do so.

MHE
Previous Topic: why there not block with timestamp ?
Next Topic: how to call script inside form!!!
Goto Forum:
  


Current Time: Fri Dec 09 01:43:03 CST 2016

Total time taken to generate the page: 0.05089 seconds