Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
bsharma_velcro
Contributor II
Contributor II

Passing variable in SQL query while extracting data

Hi,

I am using an SQL query to fetch previous day's data from an Oracle database. This query gives me data for just previous day. I need last 45 days worth of data on a daily basis.

Is there a way I can pass a variable for the highlighted section of the query snippet below so that I can run a loop and extract data for all the past 45 days... something like sysdate - $(vDateCount) in place of the highlighted section.

bsharma_velcro_0-1730291884381.png

Regards,

Bhaskar

Labels (1)
5 Replies
Or
MVP
MVP

Sure.

https://community.qlik.com/t5/QlikView-App-Dev/Load-data-day-by-day-using-loop/td-p/1799763

Plenty of other threads about similar requirements, so a search should help you if that one isn't precisely what you want.

 

bsharma_velcro
Contributor II
Contributor II
Author

My variable doesn't go in the where clause, but in the body of the query and subqueries within, where my variable declared in Qlik are not identified.

 

Regards,

Bhaskar

Or
MVP
MVP

What makes you say that they are not identified.,?

bsharma_velcro
Contributor II
Contributor II
Author

Because it's throwing error.

Or
MVP
MVP

Sounds like you have a syntax issue, then. You may want to share your actual code...