PL/SQL Parameters   «Prev  Next»
Lesson 3How to use parameters in SQL*Plus
Objective Use parameters when starting a SQL*Plus script.

Sendig Parameters to SQL*Plus

In SQL*Plus, parameters can be sent in two different ways:
  1. You can pass parameters to a SQL*Plus script when starting SQL*Plus from the operating system command line
  2. You can pass parameters to a SQL*Plus script when using the START commands

The parameters are automatically named &1, &2, and so on based on their position. Parameters are always separated by blank space. If you need to specify a parameter that contains blanks, enclose the parameter in double quotes.
Use the following Slideshow to see how to use parameters both ways.

Using Sqlplus Parameters
Behind the scenes, SQL*Plus has defined two variables with these two names and has populated the variables with the values sent from the command line. Because SQL*Plus treats the parameters just like variables, SQL*Plus prompts the user for the parameters if the user does not provide values when starting a SQL*Plus script that references the parameters. In this case, the user must type in the value and press Enter. Then the script continues to execute.
You cannot specify parameters when using the RUN or the "/" commands to execute a SQL*Plus script.
The next lesson describes how to use parameters in PL/SQL.

Sql plus Variable Arguments

Click the link below to read about SQL*Plus parameters like those used in the Slideshow.
Sql plus Variable Arguments