Ways to access DB2 data that is not in a table

You can access DB2® data even if it is not in a table.

This method of data access can be accomplished in two ways.

Begin general-use programming interface information.
  • Set the contents of a host variable to the value of an expression by using the SET host-variable assignment statement.
    Example:
    EXEC SQL SET :HVRANDVAL = RAND(:HVRAND);
  • In addition, you can use the VALUES INTO statement to return the value of an expression in a host variable.
    Example:
    EXEC SQL VALUES RAND(:HVRAND)
    INTO :HVRANDVAL;
End general-use programming interface information.