Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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.
Thank you guys.