Executes a static SQL query by specifying its syntax.
The Execute SQL function block can throw the CwDBSQLException exception if a database error occurs.
The Execute SQL function block sends the specified query string as a static SQL statement to the database associated with the current connection. This query is sent as a string to the database, which compiles the string into an executable form and executes the SQL statement, without saving this executable form. Use Execute SQL for SQL statements that you need to execute only once.
Before executing a query with Execute SQL, you must obtain a connection to the desired database by generating a CwDBConnection object with the Get Database Connection function block.
The SQL statements you can execute include the following (as long as you have the necessary database permissions):
Use the Has More Rows and Next Row function blocks to access the retrieved data.
If the connection uses explicit transaction bracketing, you must explicitly start each transaction with the Begin Transaction function block and end it with either the Commit or Roll Back function block.
To execute stored procedures with OUT parameters, use the Execute Stored Procedure function block. For more information, see Calling stored procedures with executeStoredProcedure().
This function block is based on the CwDBConnection.executeSQL() method. For more information, see executeSQL().