Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Add a filter in tOracleInput query

Hi everyone, I want to ask you how to add a filter in tOracleInput query. Example : " select * from table1 where name='blabla'" So how to add the syntax "where name='blabla' dynamically ? Thanks for your responses.
Labels (1)
  • v7.x

1 Solution

Accepted Solutions
iamabhishek
Creator III
Creator III

The Sql queries in Talend are simply String represented in Java language format. So, to play with them you and build your query dynamically you have to make sure you built a String which will finally represent a legitimate SQL query.

Example : 

"select * from table1 where name='blabla'"

Now if you want to have your WHERE clause to be dynamic and make it pass from context variable you could simply use - 

"Select * from table1 " + context.whereclause

or if you want to get it from any previous component values

"Select * from table1 " + ((String)globalMap.get("row1.whereclause"))

Tip: Build your SQL query, output it to the console and then test the String you see in your database. If it works there, it will work in your Talend component.

View solution in original post

4 Replies
iamabhishek
Creator III
Creator III

The Sql queries in Talend are simply String represented in Java language format. So, to play with them you and build your query dynamically you have to make sure you built a String which will finally represent a legitimate SQL query.

Example : 

"select * from table1 where name='blabla'"

Now if you want to have your WHERE clause to be dynamic and make it pass from context variable you could simply use - 

"Select * from table1 " + context.whereclause

or if you want to get it from any previous component values

"Select * from table1 " + ((String)globalMap.get("row1.whereclause"))

Tip: Build your SQL query, output it to the console and then test the String you see in your database. If it works there, it will work in your Talend component.

fdenis
Master
Master

use context or globalMap variables to store blabla
the use java syntax ("select * from table where name=''" + globalMap.get("blablaVariableName")+ "") to write yours query.
regards
Anonymous
Not applicable
Author

Thank you guys.

fdenis
Master
Master

hi,

One day you are going to help me or someone!

you can use kudos to thank.
you can Tag "solved" to help on same problems.

Regards,