SQLCURSOR

Submits an SQL (Structured Query Language) statement to a database server and returns a multi-row result.

Supported Script Types

Generic Email Chat Phone Voicemail Work Item

Properties

SQLQuery
This property is the SQL statement that will be submitted to the database server. This statement should be expected to return records.
GlobalVariables
This property is currently not used.
Publish
This property publishes a variable and value from the last name that is retrieved. For example, if there were three names retrieved, only data from the last name would be published.
TimeoutSec
The number of seconds until the query times out. The default is 10. The maximum number of seconds supported is 30 (though larger numbers can actually be entered in the field).

Branches

Default
The Default branch condition will be used unless another branch condition is met.
OnNoRecords
When data is not returned from the database, this branch condition is triggered.
OnError
When the SQL Query is invalid, this branch condition is triggered.

Tips and Tricks

  • Use SQLCURSOR for the same purpose as SQLSELECT when multiple rows are expected.
  • This action does not retrieve all the rows at once. Instead, the dataset is opened and kept open for repetitive access.
  • As with SQLSELECT, each column is stored in a variable with the same name as the column. Initially, the first record will be fetched. To fetch consecutive records, execute SQLNEXT repeatedly until SQLNEXT triggers its End of Dataset branch condition.
  • If the script does not need to continue fetching all records, place the SQLCLOSE action after the End of Dataset branch condition. This will manually close the dataset. This ensures that the database memory is released and potential record locks will not be left active.