The rules and restrictions are:
- Only one SELECT AND CONSUME statement can appear in a multistatement request.
- A multistatement request that includes a SELECT AND CONSUME statement cannot also include a DELETE, UPDATE, UPSERT, or MERGE statement that references the same queue table.
- SELECT AND CONSUME statements cannot be specified in any of these SQL constructs:
- Subqueries with the exception INSERT … SELECT statements
- Search conditions
- Logical predicates
- Operations using the SQL UNION, MINUS, or EXCEPT/MINUS SET operators
- A limit of 20 percent of the total possible PE sessions (24 per PE by default) can enter a delay state as a result of submitting a SELECT AND CONSUME statement.
- For embedded SQL, the selection form of a DECLARE CURSOR statement cannot specify a SELECT AND CONSUME statement if the preprocessor TRANSACT or -tr option is set to ANSI.