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

Default Values

When a variable is defined in a procedure or function, a default value can optionally be assigned.  When the procedure is called, the passed variables are assigned in order; those that are not assigned use the default value.  If the default values of leading variables should be used, then the variables must be passed by name so that they are correctly assigned to the procedure’s variables.

SQL> create or replace procedure example_defaults
  2    (n_1 in number := 5,
  3     n_2 in number := 6,
  4     n_3 in number := 7)
  5  as
  6  begin
  7    dbms_output.put_line(n_1||n_2||n_3);
  8  end;
  9  / 

Procedure created.

The code fragment above defines a procedure called example_defaults that has three variables.  In the code on line 7, we see that three variables are sent to the buffer for display.  The method the programmer uses (e.g. named variable, list of variables) to call the procedure will determine which values are passed and which will use the default values.

SQL> begin
  2    example_defaults(7,8,9);
  3    example_defaults(7,8);
  4    example_defaults(7);
  5    example_defaults();
  6  end;
  7  / 


PL/SQL procedure successfully completed.

Notice that the variables are assigned in the order that they appear, and those variables that are not assigned will use their default values.  If they are not passed in order, they must be passed by name.

SQL> begin
  2    example_defaults(7,8,9);
  3    example_defaults(n_2=>7,n_3=>8);
  4    example_defaults(n_3=>3);
  5    example_defaults(n_3=>5);
  6  end;
  7  / 


All the values not passed by name to the procedure will take their default value.  If a variable is not assigned a default value, then the call to that procedure must assign it a value or the call will fail. 

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.