Add a filter in tOracleInput query

Highlighted
Four Stars

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.

Accepted Solutions
Highlighted
Nine Stars

Re: Add a filter in tOracleInput query

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


All Replies
Highlighted
Nine Stars

Re: Add a filter in tOracleInput query

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

Highlighted
Thirteen Stars

Re: Add a filter in tOracleInput query

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

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Highlighted
Four Stars

Re: Add a filter in tOracleInput query

Thank you guys.

Highlighted
Thirteen Stars

Re: Add a filter in tOracleInput query

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,

Francois Denis

Tag as "solved" for others! Kudos to thanks!

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog

Downloads and Trials

Test drive Talend's enterprise products.

Downloads