NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
E-12
Considerations—EXECUTE IMMEDIATE
:host-var
identifies a host variable declared as an alphabetic or alphanumeric data item;
host-var must contain the SQL statement as a string literal.
If the SQL statement is an INSERT statement, the statement cannot contain the
RETURNING clause.
The SQL statement must not contain parameters or refer to host variables.
Considerations—EXECUTE IMMEDIATE
You can use EXECUTE IMMEDIATE for any DDL, DML, or DCL, or DSL
statement, except OPEN, CLOSE, and SELECT. (Use a cursor to process a
SELECT statement.)
If the program declares an SQLSA, EXECUTE IMMEDIATE does not return
execution statistics as described under INCLUDE SQLSA. EXECUTE
IMMEDIATE does not return compilation statistics.
Examples—EXECUTE IMMEDIATE
The following SQL statement from a C program executes an SQL statement whose
text is contained in the host variable named :statement:
EXEC SQL EXECUTE IMMEDIATE :statement;
EXISTS Predicate
EXISTS is a predicate that determines whether any rows satisfy conditions in a
subquery. The EXISTS predicate evaluates to true if the subquery finds at least one row
that satisfies the search condition.
In an EXISTS predicate, the result of subquery can be a table of more than one
column.
An EXISTS subquery is typically correlated with an outer query.
[ NOT ] EXISTS subquery