BC remote Oracle DBA - Call (800) 766-1884
Free Oracle Tips

Oracle Consulting Oracle Training Development

Remote DBA

 

Remote DBA Plans
Remote DBA Service

 
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Internals Magazine
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 

 

   
  Oracle Tips by Burleson

Calling Procedures from PL/SQL

If calling a procedure from SQL*Plus is easy, calling it from PL/SQL is effortless.  Simply call it in the code section of any PL/SQL block

SQL> create or replace procedure get_area
  2    (n_length in number,
  3     n_width  in number,
  4     n_area  out number)
  5  as
  6  begin
  7    n_area := n_length*n_width;
  8  end get_area;
  9  / 

Procedure created.

SQL> declare
  2    n_area number :=0;
  3  begin
  4    get_area(10,20,n_area);
  5    dbms_output.put_line('Area '||n_area);
  6  end;
  7  /

Area 200
 

Notice that the EXECUTE clause is not used.  That is a SQL*Plus  command and not used in PL/SQL.  Also notice that the n_area variable is not passed by reference as in the SQL*Plus call.  This is because the variable is local where as in the SQL*Plus example, it was external to the database.

The Return Clause with Procedures

As shown in the next section, a PL/SQL function is required to return a value using the RETURN clause.  A procedure can also use the RETURN clause but can not return a value.  Instead, the RETURN clause terminates execution of the procedure and processing passes back to the calling code.  If the procedure was passed OUT or INOUT variables, the procedure will copy their values as of the RETURN clause.  As with the GOTO clause, using the RETURN clause to terminate a procedure is considered bad programming practice and should be avoided. 


The above book excerpt is from:

Easy Oracle PL/SQL Programming

Get Started Fast with Working PL/SQL Code Examples

ISBN 0-9759135-7-3   

John Garmany 

http://www.rampant-books.com/book_2005_1_easy_plsql.htm

Remote DBA Service
 

Oracle Tuning Book

Free Oracle dictionary reference poster

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

North Carolina Oracle Users Group

 

 Arabian horse breeder

Seeing eye horses

 

 

Burleson is the American Team

American Flag

 

 

BC Remote Oracle Support
P.O. Box 511 • Kittrell, NC, 27544

Remote DBA

Remote DBA Services

 

Copyright © 1996 -  2011 by Burleson Enterprises. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.