How to run a stored procedure directly from a begin- end; statement?

500 pts.
Tags:
DBMS
Oracle
PL/SQL block
SQL
I have a stored procedure with some dbms_output statements in it , i want to run this stored produre directly from begin end; statement in order to check how it woks...

Software/Hardware used:
Oracle

Answer Wiki

Thanks. We'll let you know when a new response is added.

yes correct.you can directly call the procedure/function from any pl/sql block along with the parameters. if you are using sql* plus editor then we need to use exec before procedure name.

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    Hi hussain22juze.  If you want to run it on Sql*Plus or SQL Developer, you can do it this way:
    set serveroutput on;
    exec your_procedure_name (<parameters);
    69,175 pointsBadges:
    report
  • hussain22juzer
    I have tried something like this: begin exec set_actual_rate(); end; / my procedure name is set_actual_rate(); (create or replace procedure set_actual_rate is ) i'm getting this error--- "" ORA-06550: line 2, column 6: PLS-00103: Encountered the symbol "SET_ACTUAL_RATE" when expecting one of the following: := . ( @ % ; The symbol ":=" was substituted for "SET_ACTUAL_RATE" to continue. 1. begin 2. exec set_actual_rate; 3. end; 4. / ""
    500 pointsBadges:
    report
  • carlosdl
    Oh, now I understand. If you want to run it from a pls/sql block (begin...end), just remove the "exec" word.
    begin
    set_actual_rate();
     end;
     /
    69,175 pointsBadges:
    report
  • carlosdl
    You still need to set the serveroutput option to "on", but that needs to be done outside the pl/sql block, and only once, no matter how many times you run this or any other stored procedure.
    69,175 pointsBadges:
    report
  • hussain22juzer
    Thanks , but i never set setserveroutput on; , still it worked...
    500 pointsBadges:
    report
  • carlosdl
    Good to know, thanks for posting back.The serveroutput setting is usually needed to be able to see the messages you display by calling the dbms_ouput package, but it doesn't really affect the procedure execution.
    69,175 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following