Toad World® Forums

How to set SQL output as Variable to be used at PERIOD on Email subject, Toad Automation 13.3.0.181

How to set SQL output as User Variable to be used at PERIOD on Email subject, Toad Automation 13.3.0.181. While sending the email via Automation, want to add (current_month + 3) as Period information. %DATETIME% is working fine, but not abel to save SQL output (1 row, 1 column) to User Variable %Period%. The value section is taking SQL script as text not as query.

SAMPLE INPUT SQL in %Period% variable's value section

SELECT 'P'||EXTRACT(MONTH FROM SYSDATE) as current_month FROM DUAL;

Sample email subject:
test - ESPRIT check file for %Period% - Started

--where %Period% is User Variable

Expected output:
test - ESPRIT check file for P4 - Started

Try this:

Using Query Iterator action to run a query and turn its result into a variable.
Notice that the email action is a child action of the iterator (that is, it's not after it but under it)

image

Query iterator action properties:

So in this case, the variable is going to be called %Query Iterator1.Output%.