How to Pass mutliple values from text file to parametrized bteq

Teradata Applications

How to Pass mutliple values from text file to parametrized bteq

Hi ,

i have extracted below two records in a file

Start_Date     End_Date

2014-01-01    2014-06-30

2014-07-01    2014-12-31

i am pasing this a query now

select * from tablename where Start_Date = {Start_Date}

and End_date = {End_Date}

Earlier i was passing only one row but now i am passing two values

When i execute this bteq , the sql which run is as below

select * from tablename where Start_Date = '2014-01-01    

2014-06-30'

and End_date = '2014-07-01    

2014-12-31'

Can you please tell how i can make it as IN End_date IN some thing like that or there is any other way i can pass multiple values to paramterized bteq

3 REPLIES

Re: How to Pass mutliple values from text file to parametrized bteq

If I understand you correctly.

You can think of a unix script, running a loop(for,while,do while). Inside a loop, do a readline.

Extract or cut  the first field start_date delimited by a space and put in your sql script accordingly.So also for the end_date. So your bteq script is inside a unix loop.

Re: How to Pass mutliple values from text file to parametrized bteq

Thanks alot Raja!

Can we in a way so that i can pass all values to variable in one go and we can use IN operator in sql

select * from tablename where Start_Date in ( {Start_Date1} ,{Start_Date2});

something like that .

Re: How to Pass mutliple values from text file to parametrized bteq

Very much you can do that. You can assign the entire thing to a variable and use that as parameter. For ease of testing, use echo and see the output, whether it conforms to SQL syntax properly or not and then implement it.