SQL$HELP72.HLB  —  ACCEPT
    Prompts the user for additional information. This information is
    stored in an interactive SQL variable, which can subsequently be
    used by DML and some SET statements.

1  –  Environment

    You can use the ACCEPT statement in interactive SQL.

2  –  Format

  (B)0ACCEPT qq> <variable-ref> qwqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqwq>
                             x tq> DEFAULT <default-value> qqqu x
                             x tq> HIDE qqqqqqqqqqqqqqqqqqqqqqu x
                             x tq> PROMPT <string-literal> qqqu x
                             x tq> NOPROMPT qqqqqqqqqqqqqqqqqqu x
                             x tq> TIMEOUT <numeric-literal> qu x
                             x mq> UPPER qqqqqqqqqqqqqqqqqqqqqj x
                             mqqqqqqqqqqqqqq <qqqqqqqqqqqqqqqqqqj
                              

  (B)0variable-ref =   

  qqwqqqqqwqqq> identifier qwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwq>
    m> : qj                 mqwqqqqqqqqqqqqqwq> : identifier j
                              m> INDICATOR qj

3  –  Arguments

3.1  –  DEFAULT default-value

    Provides a default value to be used if the user presses the
    Return key. The default value must be a correctly formatted
    character string that can be converted to the data type of the
    variable.

3.2  –  HIDE

    Disables echo of the input text. The default is to echo all input
    characters.

3.3  –  PROMPT string-literal

    Provides a prompt string that is displayed before accepting
    input.

3.4  –  NOPROMPT

    Disables prompting with a string.

3.5  –  TIMEOUT numeric-literal

    If the user does not respond within this many seconds, then an
    error is returned. Negative or zero values of the numeric-literal
    are ignored. The default is to wait indefinitely.

3.6  –  UPPER

    All lowercase characters are converted to uppercase before
    assignment to the variable. The default is to leave lowercase
    characters unchanged.

3.7  –  variable-ref

    An interactive SQL variable defined using the DECLARE Variable
    statement.

4  –  Examples

    Example 1: Prompting Based on the PROMPT and NOPROMPT Clauses

    SQL> DECLARE :x INTEGER;
    SQL> DECLARE :y INTEGER;
    SQL>
    SQL> ACCEPT :x indicator :y PROMPT 'what value? ';
    what value? 10
    SQL> PRINT :x, :y;
               X             Y
              10             0
    SQL>
    SQL> ACCEPT :x INDICATOR :y NOPROMPT;
    11
    SQL> PRINT :x, :y;
               X             Y
              11             0
    SQL>
    SQL> ACCEPT :x;
    Enter value for X: 12
    SQL> PRINT :x;
               X
              12
    SQL>

    Example 2: Using ACCEPT to Prompt for SET FLAGS String

    This sequence would be included in a script.

    SQL> DECLARE :debug_flags CHAR(20);
    SQL> ACCEPT :debug_flags;
    Enter value for DEBUG_FLAGS: trace
    SQL> PRINT :debug_flags;
     DEBUG_FLAGS
     trace
    SQL> SET FLAGS :debug_flags;
    SQL> SHOW FLAGS

    Alias RDB$DBHANDLE:
    Flags currently set for Oracle Rdb:
       PREFIX,TRACE,MAX_RECURSION(100)
Close Help