Monday 17 October 2011

Define & Accept Command

Use the DEFINE command to explicitly create substitution variables. The DEFINE command can also be used to display the value of a known variable. It shows the variable name, value and type. Using DEFINE with no arguments lists all defined substitution variables. Any variable that DEFINE lists is said to be defined. A variable may be redefined by repeating the DEFINE command with a different value. The DEFINE command only ever creates variables with type CHAR.
The ACCEPT command always prompts for a variable's value, creating a new variable or replacing an existing one. ACCEPT has advantages over a double ampersand (&&) variable reference that causes a prompt. ACCEPT allows the prompting text to be customized and allows a default value to be specified. ACCEPT does type and format checking. The ACCEPT command understands numbers, strings and dates. If a FORMAT clause is used, SQL*Plus validates the input against the given format. If the input is not valid, you are re-prompted for a value.

No comments:

Post a Comment