sqldynrq() — Execute a Dynamic Non-SELECT Statement
Compiles and executes any dynamic ESQL statement other than a cursor specification. This function supports the dynamic EXEC SQL EXECUTE IMMEDIATE... statement.
This function returns normalized values. For more information, see the function return values in the "General Diagnostics" section in this chapter:
sqln
The address of a pointer to a request handle value associated with and returned for the statement. For more information on request handles, see the "SQL Request Handles" section.
prequest
A pointer to the text of a non-SELECT statement.
NOTES
EXAMPLE
- Examples of non-cursor specification statements are Data Definition Language (DDL) statements like CREATE TABLE or DROP TABLE, or simple Data Manipulation Language (DML) statements like INSERT or searched DELETE and UPDATE. You can also prepare (compile) and repeatedly execute any of these statements (possibly including parameter markers) using
sqldynprep()
andsqldynexec()
.- This function can also compile and execute positioned UPDATE and DELETE statements. The cursor name referenced in the statement must already be opened and positioned on a record.
- The
sqldynrq()
function is functionally equivalent tosqldynprep()
followed bysqldynexec()
.- This function releases all memory for the SQL request after executing it.
- Dynamic request strings cannot contain the following:
- DECLARE CURSOR, OPEN, FETCH, or CLOSE statements used to manage cursor specifications.
- References to embedded host variable names.
- SQL comments.
- Dynamic parameters in a context that prevents the data type of the surrounding expression from being inferred.
For more information and additional restrictions in the request string, see Programming with ESQL."
This example prompts the user to enter an UPDATE or DELETE statement for some table. The user can actually enter either a positioned or searched UPDATE or DELETE, depending on the availability of an open cursor. Statements are passed in the string request:
SEE ALSO
sqldynexec() — Execute a Dynamic SQL Statement, sqldynprep() — Prepare a Dynamic SQL Statement, sqlrequest() — Execute a Static ESQL Statement for static non-cursor statements.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |