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.
- Set the contents of a host variable to the value of an expression by using the SET host-variable assignment statement.
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.
EXEC SQL VALUES RAND(:HVRAND) INTO :HVRANDVAL;