Call for Oracle support & training (800) 766-1884
Free Oracle Tips

Corporate Oracle Training
Custom Oracle Training
Oracle New Features Training
Advanced Oracle DBA Classes
Oracle Tuning Courses
Oracle Tips & Tricks
Oracle Training Links
Oracle Training Links
Oracle Training Links

We are top for USA Oracle Training Clients


Free Oracle Tips


Free Oracle App Server Tips


Oracle support

Oracle training

Oracle tuning


Remote Oracle

Custom Oracle Training


  Oracle Tips by Burleson

Calling Procedures from SQL*Plus

To call a procedure from SQL*Plus use the execute command.

SQL> set serveroutput on
SQL> execute num_check(5);
Number OK 

PL/SQL procedure successfully completed.

Because this procedure writes data to the buffer, SQL*Plus must be told to retrieve and display it.  The SET SERVEROUTPUT ON  command directs SQL*Plus to do this.  The execute command runs the num_check procedure passing the literal number 5 as the IN variable.  In order to execute a procedure from SQL*Plus that contains an OUT or INOUT variable, a SQL*Plus variable must be created and used.  In the example below, the procedure get_area is created and then executed being passed three variables.  It then calculates the area and copies that value to the OUT variable n_area.

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> variable w_area number;
SQL> exec get_area(10,20,:w_area); 

PL/SQL procedure successfully completed.

SQL> print w_area 


The variable w_area is the SQL*Plus  variable.  It is passed to the procedure by reference as indicated by the colon at the beginning of the variable name. 

PL/SQL does not impose a limit on the number of variables that are passed into a procedure; however, the practical limit is based on user requirements.  The more variables that are passed to a procedure, the harder it is to use and the more likely that the developer will cause errors.  If the number of variables is too large, look at creating compound variables such as records, list or arrays.  Passing five to six variables is about the practical limit.  If the procedure is going to be overloaded in a package, that limit is reduced to 3 or 4 variables.  Packages and overloading procedures  is covered later in chapter 5 Bulk Operations, Packages and Triggers.

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


Oracle performance tuning book



Oracle performance tuning software

Oracle performance tuning software
Oracle performance Tuning 10g reference poster
Oracle training in Linux commands
Oracle training Excel


email BC:

Copyright © 1996 -  2014 by Burleson Inc. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.