SQL$HELP_OLD72.HLB  —  SET Control
    Assigns a value to a target parameter or a variable name.

1  –  Environment

    You can use the SET assignment control statement in a compound
    statement:

    o  In interactive SQL

    o  Embedded in host language programs to be precompiled

    o  As part of a procedure in an SQL module

    o  In dynamic SQL as a statement to be dynamically executed

2  –  Format

  set-assignment-statement =

  SET -+-> <parameter> -----+-> = --+--> value-expr -+->
       +-> <variable-name> -+       +--> NULL -------+

3  –  Arguments

3.1  –  NULL

    Assigns the NULL value to a target parameter or variable name.

3.2  –  parameter

    Specifies the target where SQL stores a value expression or the
    NULL value.

3.3  –  value-expr

    Assigns the value of a value expression to a target parameter or
    variable name.

3.4  –  variable-name

    Specifies the target where SQL stores a value expression or the
    NULL value.

4  –  Examples

    Example 1: Assigning a value expression to a target parameter

    BEGIN
    SET :y = (SELECT COUNT (*) FROM employees);
    END;

    Example 2: Assigning the NULL value expression to a target
    parameter

    BEGIN
    SET :z = NULL;
    END;
Close Help