prepare
SQL/PL
Prepare an SQL statement
Syntax
prepare_stmt:
PREPARE stmt_name FROM {var_name | string_expr}
Description
The PREPARE statement compiles the statement specified either as the content of the CHAR/VARCHAR variable var_name or as a string expression. Any compilation errors that are detected during compilation will raise an appropriate exception. If compilation is successful, stmt_name can then be specified in a subsequent EXECUTE statement. If the statement string being prepared is a SELECT statement then it must be one that can only return a single row.
Example
set stmtstr = "SELECT * FROM ACCTMGR WHERE mgrid = '" || newId || "'"; prepare s2 from stmtstr; execute s2 into c_id, c_name, c_hired, c_commission; select stat, c_id, c_name, c_hired, c_commission; deallocate prepare s2;
See Also