Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to execute the oracle SQL file in talend

Hi,


I have 7 sql files with different operations. Few has Select and few has Merge/Insert/update operations. In My SQL query, I am trying to connect it to two different databases. I have given all the required table access from one DB to another DB whereas the SQL is working on Oracle SQL developer.

I am quite new in using Talend. Now, how I can refer the SQL file and execute the same in Talend. Inside the talend job where I can keep all the SQL files and how I can refer those?
After giving the connection to the DBs which component I have to use...

I have few more Queries related to this :

1. I am trying to create the txt file from the SQL result with the Header and Footer. How I can have the loop for creating the header and footer. For all the files, the header and footer is different. 
2. In my SQL, how I can pass the last run time of the table dynamically. Based on the run time available or not in the table I have few condition in my query. Ex: I am using '&' in my SQL where it has to be replaced with the last run time of the table during the execution. 

3. In my SQL files, there is 2 sql files which is running on different tables with different condition. At the end I have to combine both the results and create the file with the same header and footer (sel_1_1, sel_1_2 ) . How I can achieve this ? 

4. How I can have a loop to execute the SQL files in the mentioned order. My files are sel_1_1, sel_l_2, update_1_1, select_2_1,update_2_2,.....

Labels (2)
8 Replies
Anonymous
Not applicable
Author

Hello,

Please try to store the query from the input file in a global variable:

tFileInputRaw --row1 (main)--> tFlowToIterate --iterate--> (your oracle query component here)

The tFileInputRaw component will give you one output field which will contain the whole content of the file. In the SQL statement in your Oracle component, put something like ((String)globalMap.get('row1.content')).

Let us know if it works.

Best regards

Sabrina

Anonymous
Not applicable
Author

Hi,

I have tried the same flow. I am using toracleinput component. In the sql component, my query is "((object)globlama.get("row1.content"))". I am getting the error Assignment operator expected after this token....In my sql file it is only the select statement...
If I have Merge, Update and insert altogether in my sql file which oracle component I have to use?I see that in tdbrow either we can select update/ insert.... but I have already have the query in the sql file, so in this case which component will be helpful.

Anonymous
Not applicable
Author

Hi,

 

    If you could share screenshots of your current job flow and component screenshot for problematic components, it will give us more idea about the issue.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

Anonymous
Not applicable
Author

Hi,
Due to some reason I can't able to share my screenshots... I just followed the same steps mentioned by @xdshi... The flow is tfileinputraw --row1(main) -- tflowtoiterate -- iterate ---tdboracleinput
In oracle input component I am getting the above mentioned error
Anonymous
Not applicable
Author

Can someone help me on the reported issue
manodwhb
Champion II
Champion II

@NewUser395 ,only the select statements work in tdboracleinput and he other queries you need to use tdboraclerow.

sushantk19
Creator
Creator

@Manohar B​ : can you please share the screenshot of basic and advanced settings for tDBinput or  tdboraclerow component?

Anonymous
Not applicable
Author

Hello @sushantk19

Here is a response from your another topic:

https://community.talend.com/s/question/0D55b00007VVDgfCAH/reading-sql-file-in-talend

Hope it will be helpful for your case.

Best regards

Sabrina