Home » SQL & PL/SQL » SQL & PL/SQL » how to put create procedure script inside logic block
how to put create procedure script inside logic block [message #253560] Tue, 24 July 2007 05:14 Go to next message
rajesh_bhadu
Messages: 48
Registered: June 2007
Member
Hi All,

I want to create two procedure as code mention below.
But before creating them I have to make sure that status in Status table(already exist in db) is Initialized, if status is not Initialized then script of create procedure should not be executed.

Here is script......


create or replace procedure parent


AS
  

BEGIN

 test_pro();

 dbms_output.put_line('... parent...' );
 
   
END;

/
insert into Test(fname,lname) values('test1','test2');
create or replace procedure test_pro as
 
    
begin
 dbms_output.put_line('..test_pro....');
end test_pro;




Above script is dummy one.

Plesae tell me how can I check before executing create procedure and insert script that status is correct.

I have tried this by using Execute Immediate and then string of create procedure script inside an anonymous block but then how i'll put message inside dbms_output.put_line using single qoutes.


Thanks in Advance.

Rajesh Embarassed Embarassed
Re: how to put create procedure script inside logic block [message #253582 is a reply to message #253560] Tue, 24 July 2007 06:18 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> begin
  2    execute immediate 'begin dbms_output.put_line(''OK''); end;';
  3  end;
  4  /
OK

PL/SQL procedure successfully completed.

Regards
Michel
Re: how to put create procedure script inside logic block [message #253603 is a reply to message #253582] Tue, 24 July 2007 06:53 Go to previous message
rajesh_bhadu
Messages: 48
Registered: June 2007
Member
Thanx Michel. Razz

It's working......... Razz
Previous Topic: I don't want to raise NO-DATA-FOUND. How to do that? (split)
Next Topic: How to delete records based on two tables using join without sub query?
Goto Forum:
  


Current Time: Sat Dec 10 18:50:44 CST 2016

Total time taken to generate the page: 0.09718 seconds