how to get a part of a text from a column in the database using tdbnput and print in talend

Viewed 127

enter image description here

I have a talend job that goes like the above one and i am using a select statement to access the data from oracle

select id,name,details from employee ;

and send the results via email.However for a particular column details it has 10 different lines and that are dynamic and has various other unwanted/irrelevant information and i would like to precisely filter few lines and print them to the mail using tjava component.

How can i do that?

for eg:details column has values like: "hi i am john i work at abc i go to oxford i reside at 1st street goodbye" so the lines are totally random,i would want to match based on a specific keyword lets say "reside at" alone and filter that for different records and capture that in that output?

1 Answers

In order to do this you need to create a custom SQL query in the tDBinput.

"select id,name,details from employee
where details like '%reside at%'"

(Where the % are any text check the SQL "LIKE" function for more details)

With this you will filter the row you want. If you need more filter you can modify you SQL query like you want.

Related