skip to main content

Embedded SQL : Dynamic SQL

Dynamic SQL
While embedded SQL is fine for fixed applications, sometimes it is important for a program to dynamically create entire SQL statements. With dynamic SQL, a statement stored in a string variable can be issued. PREPARE turns a character string into a SQL statement, and EXECUTE executes that statement.
PREPARE and EXECUTE may be combined into one statement using the IMMEDIATE clause of the EXECUTE statement.
Code example
working-storage section.
exec sql include SQLCA end-exec.
77 cmd usage handle.
procedure division.
exec sql prepare :cmd from "DELETE FROM TABLE1" end-exec.
exec sql execute :cmd end-exec.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left