Library /sys$common/syshlp/SQL$HELP_OLD72.HLB  —  User Supplied Names, Parameters and Variables
    Parameters, routine parameters, and SQL variables are often used
    in value expressions (for information on value expression, see
    the Value_Expressions HELP topic.

    A variable is an identifier that represents a value that can
    change during the execution of a program. You can use SQL
    variables in multistatement procedures.

    A routine parameter is a variable associated with a parameter
    of a routine that is used in a stored routine or an external
    routine. A stored routine refers to both stored procedures and
    stored functions defined using the CREATE MODULE statement. An
    external routine refers to both external procedures and external
    functions defined using the CREATE PROCEDURE and CREATE FUNCTION
    statements.

    When you use SQL variables in multistatement procedures or when
    you use routine parameters, you do not use indicator variables.
    See the Multistatement_Variables_and_Stored_Routines HELP topic
    for more information about SQL variables in multistatement
    procedures and stored routine parameters. See the External_
    Routine_Parameters HELP topic for more information about external
    routine parameters.

    A parameter is an identifier declared in a host language program
    that is associated with an SQL statement. A parameter represents
    values that can change during the execution of a program.
    Many SQL data manipulation clauses that do not accept general
    value expressions require parameters. However, you cannot use
    parameters in data definition language statements.

    You can use parameters in the following places:

    o  Interactive SQL

       In interactive SQL, you use the DECLARE Variable statement to
       declare the parameter. For more information about declaring
       parameters and variables, see DECLARE Variable.

    o  SQL module language

       In programs that call SQL module procedures containing SQL
       statements, references to host language variables by SQL
       statements are indirect. The variable declared in the program
       is specified as a parameter in a host language call statement
       to a procedure in the SQL module. Parameters in such call
       statements are called actual parameters.

       In nonstored procedures, the SQL module procedure contains
       parameter declarations that correspond to the actual
       parameters in the calling program. Module parameters in those
       declarations are called formal parameters. The SQL statement
       in the module procedure uses the formal parameter name to
       refer indirectly to the actual parameter named in the host
       language call to the module procedure.

    o  Precompiled SQL

       In precompiled programs, SQL statements embedded in the
       program refer directly to the host language variable using it
       in the statement. The SQL precompiler supports only a subset
       of the declaration syntax for host languages. See the Oracle
       Rdb SQL Reference Manual for more information. You can only
       use parameter names that conform to the rules of the host
       language.

    o  Dynamic SQL

       In dynamic SQL, dynamically executed SQL statements refer to
       parameters with parameter markers denoted by a question mark
       (?)  in the statement string of PREPARE statements.

    SQL statements use parameters for the following purposes:

    o  SQL retrieves data from the database and places it in
       parameters for use by a program.

    o  Parameters contain data generated by a program that SQL uses
       to update the database.

    o  Data manipulation statements can specify parameters in value
       expressions.

    o  Special-purpose parameters called indicator parameters
       indicate whether or not the value stored in a corresponding
       main parameter is null. (Indicator parameters are not used in
       stored routines.)

    o  SQL puts information about the success or failure of SQL
       statements in a parameter called SQLCODE that is either
       declared explicitly or as part of the SQL Communications Area
       (SQLCA) or in the SQLSTATE status parameter (ANSI/ISO SQL
       standard).

       See SQLCA for more information on SQLCODE and SQLSTATE.

    o  SQL and programs use a collection of parameters called the
       SQL Descriptor Areas (SQLDA and SQLDA2)  to communicate
       information about dynamic SQL statements. See SQLDA for more
       information.

    SQL statements cannot use parameters to refer to columns, tables,
    or views. For instance, if BADVAR is a host language variable
    that contains the name of a table in the database, the following
    statement is invalid:

    EXEC SQL SELECT FIRST_NAME INTO :GOODVAR FROM :BADVAR END-EXEC

    When you use the precompiler, module language, or dynamic SQL,
    display operations should use CAST or EXTRACT with CHAR host
    variables to convert date-time data from binary format when
    passing data to and from the database. For example:

    EXEC SQL SELECT CAST(TBL_INT_H3 AS CHAR(4))
             INTO :string_var3
             FROM ALL_DATE_TABLE;

    For more information about the CAST and EXTRACT functions, see
    the Built_In_Functions HELP topic.
Additional Information: explode extract
Data and Indicator Parameters Host Structures and Indicator Arrays Multistatement Variables and Stored Routines External Routine Parameters
Close Help