Releasing a Statement Identifier
A statement identifier can represent only one SQL statement or (in ESQL/C) one semicolon-separated list of SQL statements at a time. A new PREPARE statement can specify an existing statement identifier if you want to bind the identifier to a different SQL statement text.
stcopy ("query2", stmtid); EXEC SQL prepare :stmtid from 'select * from customer'; EXEC SQL prepare query2 from 'select * from customer';
The variable must be a character data type. In C, it must be declared
as char
.
In an SPL routine, statement identifiers that the PREPARE statement declares are automatically defined in the local scope. Do not attempt to declare a statement identifier as having local or global scope. A statement identifier defined in one SPL routine is not visible to any other SPL routine that the same session calls. SPL statement identifiers share the same namespace as SPL variables and cursor names.