Result of tOracleInput

Five Stars

Result of tOracleInput

hi, i need to store the result returned by an sql query into a variable. Based on the value of the Variable further flow will be decided. How to do so? 

Current job flow is: 

TBufferInput >>> tFlowToIterate >>> tOracleInput >>> tJava

Query in tOracleInput = Select count(*) from EMP where EMP.id = somenumber

 

i want to get the result , and if result > 1 do something else something else.

Thanks in advance.


Accepted Solutions
Forteen Stars

Re: Result of tOracleInput

@tanvi_patil,please the check the follwing,i have used in tJava to dispaly the variable.

 

Untitled.pngUntitled.png

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.

All Replies
Forteen Stars

Re: Result of tOracleInput

@tanvi_patil,you can store the result into global variable using tSetGlobalvar and using get (String)globalMap.get() method you can get.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Five Stars

Re: Result of tOracleInput

how ? can u show me the flow of how to store. On which flow can i get the output. 

tOracleInput >>>> tSetGlobalVarible ? 

Forteen Stars

Re: Result of tOracleInput

@tanvi_patil,please find below.since from tOracleInput you should get only one column.that is count.

Untitled.png

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Five Stars

Re: Result of tOracleInput

@manodwhb can u show me the schema and settings of tOracleInput  , i don't get the varibale count. I get error saying count cannot bge resolved to a field.

 

my query:  "Select  count(*) from TEST where TEST.ID="+ ((String)globalMap.get("myKey"))  

I have 3 columns in my schemna id, col1, col2

 

 

Forteen Stars

Re: Result of tOracleInput

@tanvi_patil,when you used below query in tOracleinput shema you should get only one coumn.

"Select  count(*) as count from TEST where TEST.ID="+ ((String)globalMap.get("myKey"))  

 

Untitled.png

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Five Stars

Re: Result of tOracleInput

hi, @manodwhb ,  when i access the variable by get and display, it gives null

Forteen Stars

Re: Result of tOracleInput

@tanvi_patil,can you show me where you were dispaying variable in job?

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Five Stars

Re: Result of tOracleInput

@manodwhb in tjava for debugging purposes. 

I actually need the value of variable for making decision ,, i.e if >0 something etc

 

System.out.println("count variable"+ ((String)globalMap.get("count")) );
Forteen Stars

Re: Result of tOracleInput

@tanvi_patil,please the check the follwing,i have used in tJava to dispaly the variable.

 

Untitled.pngUntitled.png

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Forteen Stars

Re: Result of tOracleInput

@tanvi_patil,since you can do in tMap.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Five Stars

Re: Result of tOracleInput

thank you so much @manodwhb

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

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch