Toad World® Forums

Truncated loop list variable

Nested loop list in automation to get a list of field values based on an email address...

Loop one successfully grabs emails from table

Nested loop two attempts to get values from same table but based on email #LOOP_LIST_1.EMAIL# in SQL variable

#LOOP_LIST_1.EMAIL# gets truncated what should be fname.lname@domain.com becomes an error: [Teradata Database] [3706] Syntax error: expected something between the word 'lname' and '@'.

I've tried concatenating quotes to no avail. I've also tried assigning #Loop_data_2_SQL.email# to a separate variable.

Query as is:
SELECT DISTINCT A."TABLE" || ' (' || A.REASON ||')' AS TABLE_AND_REASON
FROM HP_TX_OWN_TABLES.LABSPACE_TABLE_USAGE_RPT_HTOT_EMAIL AS A
WHERE A.EMAIL = #Loop_data_2_SQL.email#

Any suggestions are appreciated.

Dave

Wait... did you simply place single quotes around the variable in the WHERE clause?
e.g. ...

o o o
WHERE A.EMAIL = '#Loop_data_2_SQL.email#'

or how did you concat the quotes... you may want to echo the contents of your variable value to see if the quotes are there already or not....

...and that was it. Thanks! I guess one of those forest through the trees things for me.

Dave

Glad it was that simple!