Toad World® Forums

Changing a variable during automation

I have a query that uses TDA’s date variables such as ‘calendar__gregorian__current__month__’ . I’d like to be able to switch that to ‘calendar__gregorian__previous__month__’ based on a query/variable earlier in the automation script. Is that possible?

Yes you can do this. I would use the find and replace feature.

Have your SQL in a script with some token that you can always find.

IE:

Select * from table where mydate = THIS_IS_TOKEN;

Based on your If statement, find and replace “THIS_IS_TOKEN” with '‘calendar__gregorian__current__month__’" or ''calendar__gregorian__previous__month__" and save to new file.

Use that new file in your execute activity.

Debbie

Thank you!!!