How do you execute that "bit of code" ? If Bteq / Unix, use Unix variables and SQL code as an "here document" (refer to your shell) Pure SQL answer : create a temp table to hold your variables/values and use it in your requests.
I am using Teradata SQL assistant in windows NT4 (sad I know!!)....I hope this answers your first question?
If the solution is to create a temp table would it be possible to give me a bit if guidance how to do this?? The tables that I am querying are the back end of a system we use, and I can't make tables on that server, but if it can done locally that would be great.