BC remote Oracle DBA - Call (800) 766-1884  
Oracle Consulting Oracle Training Development

Remote DBA

Remote DBA Plans  

Remote DBA Service

Remote DBA RAC

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 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





Remote DBA services

Remote DBA Support

Remote DBA RAC

Remote DBA Reasons

Remote Oracle Tuning

Remote DBA Links

Oracle DBA Support

Oracle DBA Forum

Oracle Disaster

Oracle Training

Oracle Tuning

Oracle Training

 Remote DBA SQL Server

Remote MSSQL Consulting

Oracle DBA Hosting

Oracle License Negotiation







  Oracle Tips by Burleson

Passing Variables

If a procedure or function is going to integrate into an application, it must perform some action that is useful.  This means that the application must be able to pass the module information and receive information back.  This is accomplished by passing variables to the module that it can use in performing the task.  In the case of a procedure, variables can be read, used and changed.  A function can read and use a variable, but can not change it (a function returns a value, more on this in a moment).  How a procedure uses a variable will be covered shortly, here we just want to discuss how they are passed to the procedure or function.

Variables passed to procedures and functions  are defined in the block definition. 

create procedure full_user_name
  (first_name in  varchar2,
   last_name  in  varchar2,
   full_name  out varchar2)

This example is the heading of a procedure called full_user_name that passes three variables: first_name; last_name; and full_name.  These three variable names are used inside the procedure and are in scope only inside the procedure.  In the example the variable values are assigned when passed. 

  v_fullName varchar2(80);
  v_first varchar2(20) := 'Bill';
  v_last  varchar2(40) := 'Smithadoodle';
  full_user_name ('Sam','Smith', v_fullName);
  full_user_name (v_first,v_last,v_fullName);

In the code fragment above, the procedure full_name is called twice.  The first call passes literal values to the procedure, while the second invocation passed predefined variables.  The order that the variables are passed is important as PL/SQL will assign them to the procedure’s variables in the order that they were passed to the procedure.  If the variables are passed out of order, they must be passed by name as in the code fragment below.

  v_fullName vatchar2(80);
  v_first varchar2(20) := 'Bill';
  v_last  varchar2(40) := 'Smithadoodle';
  full_user_name (v_last => last_name,
                  v_fullName => full_name,
                  v_first => first_name);

Here the parameters are passed out of order and must name the procedure variables they are to be assigned.  Passing by name requires that the developer know the name or the variables in the block definition.  You can use the DESCRIBE command  in SQL*Plus  to see the variables and their names.  Normally you will pass the variables in order but there are cases when you may want to pass by name.  The most common reason to pass a variable by name is to use default values. 

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 


Remote DBA Service

Oracle Tuning Book


Advance SQL Tuning Book 

BC Oracle support

Oracle books by Rampant

Oracle monitoring software







BC Remote Oracle Support

Remote DBA

Remote DBA Services

Copyright © 1996 -  2013 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.