Read File, run the query in database, save the result back to a file

Four Stars

Read File, run the query in database, save the result back to a file

Hi
Here I am explaining my situation. Need to do a mapping
Step 1. File Input (Excel)
SNO;Query;
1;select count(*) as result from demo where rownum <10;
2;select count(*) as result from demo where rownum <20;
Step 2. Run Query in Database (Oracle 9i)
Step 3: Save the count back to another file (Excel)
SNO;Count
1;9
2;19
I am using tOracleRow to execute the query. However nothing productive yet.
Please give me suggestion to deal this situation.
Thanks in advance.
-
sangi
One Star

Re: Read File, run the query in database, save the result back to a file

Hi sangi,
use a tOracleInput to get the data. You job should look like the following:
tFileInputExcel --(row)--> tFlowToIterate --(iterate)--> tOracleInput --(row)--> tIterateToFlow --(row)--> tFileOutputExcel
In tFlowToIterate you store your data in the global map. You could use the information from the global map to create your query.
In tIterateToFlow you store your result and the data of the global map back in the row.
To access the global map use: ((String)globalMap.get("rowX.name"))
Bye
Volker
Four Stars

Re: Read File, run the query in database, save the result back to a file

Hi Volker,
Thanks for the suggestion. I will try and let you know the result.
-
sangi
Four Stars

Re: Read File, run the query in database, save the result back to a file

In this flow
tFileInputExcel --(row)--> tFlowToIterate --(iterate)--> tOracleInput --(row)--> tIterateToFlow --(row)--> tFileOutputExcel
I am unable to do the following
tOracleInput --(row)--> tIterateToFlow
tOracleInput is allowing me to connect to tIterateToFlow (with Main)
Please advice me.
Thanks
-
sangi
One Star

Re: Read File, run the query in database, save the result back to a file

Hi sangi,
sorry you are right. It is not possible to connect them directly. Attached you find some screen shots. Looks scary but works...
Input
1, SELECT count(*) AS result FROM rel_release;
2, SELECT count(*) AS result FROM sys_system;

Output
1
SELECT count(*) AS result FROM rel_release;
1362
--------------------------------------------------
2
SELECT count(*) AS result FROM sys_system;
117
--------------------------------------------------

Bye
Volker
Four Stars

Re: Read File, run the query in database, save the result back to a file

Thanks a lot Volker, Its working!!! Smiley Happy

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now