Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
30
Добавлен:
16.04.2013
Размер:
2.15 Mб
Скачать

Entering Substitution Variables

Entering Substitution Variables

System variables specified with the SET command can affect iSQL*Plus behavior. SET DEFINE, SET ESCAPE, SET VERIFY ON, and SET CONCAT affect variable substitution behavior, and should be set in iSQL*Plus before attempting to execute a script. For further information about these SET options, see the SET command in Chapter 5, "Command Reference".

’&’ variables are parsed in iSQL*Plus before the script is sent to the SQL*Plus engine, and then in the SQL*Plus engine. You should synchronize variable substitution with one of the two following options:

Enter SET DEFINE ON to set iSQL*Plus to always prompt for substitution variables. Click the Execute button to execute the command.

Enter your script using ’&’ and ’&&’ as the prefix for variables. Do not use DEFINE, or UNDEFINE. Click the Execute button to execute the script. iSQL*Plus prompts you for values for all the substitution variables in your script. At the end of script execution, any double ampersand values contained in the script remain DEFINEd. This means that you will not be prompted to enter values for these variables again, until they have been UNDEFINEd, or you log out of iSQL*Plus. If this is not the behavior you want, then use a single ampersand as the prefix for variables in your script. You are always prompted for value substitution for variables created with a single ampersand prefix.

Enter SET DEFINE OFF to set iSQL*Plus never to prompt for substitution variables. Click the Execute button to execute the command.

Enter your script. Enter SET DEFINE ON, and DEFINE all variables with ’&’ or ’&&’ before they are referenced. You can also use COLUMN ... new_value or COLUMN ... old_value to instantiate substitution variables. Click the Execute button to execute the script. iSQL*Plus does not prompt you for values for substitution variables. In this usage, be aware that iSQL*Plus substitutes a NULL value for any variable you do not DEFINE in the script.

The Define Substitution Variables Screen

When iSQL*Plus executes a script containing substitution variables, the Define Substitution Variables screen is displayed. For example, when you enter:

BREAK ON &SORTCOL

SELECT &SORTCOL, SALARY

FROM &MYTABLE

WHERE SALARY > 12000

ORDER BY &SORTCOL

4-4 iSQL*Plus User’s Guide and Reference

Entering Substitution Variables

iSQL*Plus displays:

Different web browsers, and the size of the web browser window, may affect the appearance and layout of the Define Substitution Variables screen.

Password Icon Click the Password icon to change your password. The Change Password screen is displayed.

Log Out Icon Click the Log Out icon to exit iSQL*Plus. You are returned to the Log In screen.

Help Icon Click the Help icon to access the iSQL*Plus User’s Guide and Reference in a separate browser window.

Define Substitution Variables Enter values for the substitution variables. For example, enter LAST_NAME in the sortcol field, and EMP_DETAILS_VIEW in the mytable field of the example script.

Submit for Execution Click the Submit for Execution button to execute the script in the input area with the substitution variable values you entered. Depending on the Output dropdown list selection, the results of the execution are displayed, or saved to a file.

Cancel Click the Cancel button to return to the Work screen without executing the script in the input area.

Using iSQL*Plus 4-5

Соседние файлы в папке Oracle 9.0.1