Sql*Plus User’s Guide and Reference


-18 SQL*Plus User's Guide and Reference Example 5–11


Download 5.34 Mb.
Pdf ko'rish
bet71/103
Sana04.08.2023
Hajmi5.34 Mb.
#1665146
1   ...   67   68   69   70   71   72   73   74   ...   103
Bog'liq
E18404-12

5-18
SQL*Plus User's Guide and Reference
Example 5–11
Passing Parameters through START
To create a new script based on SALES that takes a parameter specifying the job to be 
displayed, enter
GET SALES
6
CHANGE /SA_MAN/&1
SAVE ONEJOB
Now run the command with the parameter SA_MAN:
START ONEJOB SA_MAN
SQL*Plus lists the line of the SQL command that contains the parameter, before and 
after replacing the parameter with its value, and then displays the output:
You can use many parameters in a script. Within a script, you can refer to each 
parameter many times, and you can include the parameters in any order.
While you cannot use parameters when you run a command with RUN or slash (/), 
you could use substitution variables instead. 
Before continuing, return the columns to their original heading by entering the 
following command:
CLEAR COLUMN
1 COLUMN LAST_NAME HEADING 'LAST NAME'
2 COLUMN SALARY HEADING 'MONTHLY SALARY' FORMAT $99,999
3 COLUMN COMMISSION_PCT HEADING 'COMMISSION %' FORMAT 90.90
4 SELECT LAST_NAME, SALARY, COMMISSION_PCT
5 FROM EMP_DETAILS_VIEW
6* WHERE JOB_ID='SA_MAN'
6* WHERE JOB_ID='SA_MAN'
6* WHERE JOB_ID='&1'
Created file ONEJOB
old 3: WHERE JOB_ID='&1'
new 3: WHERE JOB_ID='SA_MAN'
LAST NAME MONTHLY SALARY COMMISSION %
------------------------- -------------- ------------
Russell $14,000 0.40
Partners $13,500 0.30
Errazuriz $12,000 0.30
Cambrault $11,000 0.30
Zlotkey $10,500 0.20


Communicating with the User
Using Scripts in SQL*Plus
5-19
Communicating with the User
Three SQL*Plus commands—PROMPT, ACCEPT, and PAUSE—help you 
communicate with the end user. These commands enable you to send messages to the 
screen and receive input from the user, including a simple Return. You can also use 
PROMPT and ACCEPT to customize the prompts for values SQL*Plus automatically 
generates for substitution variables.

Download 5.34 Mb.

Do'stlaringiz bilan baham:
1   ...   67   68   69   70   71   72   73   74   ...   103




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling