The required Decision SQL statement must be a valid SQL SELECT or INVOKE statement, or a valid SQL fragment. A SQL fragment is a SELECT statement that has only a SELECT clause, or only a WHERE clause.
The Decision SQL is executed when the Decision is called. If it is a SELECT statement:
•If the query retrieves 1 row, the Yes Action script is executed once. If that script contains placeholders ( :1, :2 ... ), then these are substituted by values from the SELECT output list for the retrieved row. •If the query retrieves more than 1 row, the Yes Action script is executed once for each row. If the script contains placeholders ( :1, :2 ...), each time these are substituted by values supplied by the row that is currently processed. •If the query does not retrieve any rows, the No Action script is executed once. If it is an INVOKE statement, the INVOKE statement is executed, and then the Yes Action script is executed. If the Yes Action contains placeholders (:1, :2 ...), then these are substituted by result values returned by the invocation.
If the Decision SQL consists of a SELECT clause only, the expressions in the output list are evaluated and passed to the Yes Action, where they substitute placeholders ( :1, :2 ...):
SELECT 'data-report(''' ||
RulesEngine.GetProperty('tempdir') ||
'\ClipBoard_' || :"CurrentInfoBox" || '.xml'')'
|
In this case, a WHERE clause may be added even if a FROM clause is not present:
SELECT 'data-report(''' ||
RulesEngine.GetProperty('tempdir') ||
'\ClipBoard_' || :"CurrentInfoBox" || '.xml'')'
WHERE NOT :"CurrentInfoBox" IS NULL
|
If the Decision SQL consists of a WHERE clause only, the Yes Action script is executed once if the WHERE condition evaluates to true. The No Action script is executed once if the WHERE condition evaluates to false.
WHERE :f_datatype = 'CHECK'
|
The WHERE keyword may be omitted in this case:
If the Decision SQL is empty, the Yes Action script is executed once.
For examples of Decision SQL values and how they collaborate with Yes Action scripts, see the Yes Action section below.
|