TeleFlow Step 0835

TeleFlow Step 0835

From TeleFlow

Jump to: navigation, search

Image:Iv_835.gif SQL Fetch Step
Retrieves/fetches a single record/row of results of a SQL Statement step (running a SQL Fetch for a SQL Statement that doesn't generate results - such as an UPDATE - will generate a Fatal Error). Each time a SQL Fetch is run, it retrieves the next row of results for the associated SQL Statement step, failing if there are no more rows.

How the results are retrieved: The row results are stored in TeleFlow variables, with each field or alias defined in the SQL Select statement populating a variable. If a variable with a name matching one of the fields exists, that variable is used to store the result. Otherwise, a global variable of that name is created and populated when the SQL Fetch is run. (Since TeleFlow treats all variables as UPPER CASE regardless of how they are addressed in an application, the newly created variables are created upper case) For the following example SQL Select statement, the TeleFlow Variables @FIRST_NAME, @LAST_NAME, and @EMAIL_ADDRESS would be created and populated or populated when the SQL Fetch for the statement runs, assuming there are any rows matching the criteria:
Select
first_name,
last_name,
email AS EMAIL_ADDRESS
From customer
Where user_id = 12345

Note: Please refer to the SQL Users Guide for more information about SQL programming in TeleFlow.

Properties

SQL handle (1..9): The SQL Handle of the SQL Statement step to fetch a row for. This is how a SQL Fetch step is related to a SQL Statement step. Typically, a SQL Statement step that has a result set is followed immediately by a SQL Fetch in the application flow. Handles can range from 1 to 9. e.g.: 1 or @HANDLE

Action Steps

Image:Iv_930.gif Failure: A SQL Fetch failure occurs when there are no rows to retrieve from the database. This occurs when the SQL Statement the fetch is related to doesn't result in any rows matching the statement's criteria, or when repeated uses of the Fetch step run out of matching rows. This means that a failure on a SQL Fetch step doesn't necessarily mean anything has gone wrong, although it might, under the right circumstances.

Related Steps

Image:Iv_800.gif DB Connect
Image:Iv_805.gif DB Disconnect
Image:Iv_830.gif SQL End
Image:Iv_810.gif SQL Statement