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
Thirteen 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

All Replies
Thirteen 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
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 ? 

Thirteen 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
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

 

 

Thirteen 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
Five Stars

Re: Result of tOracleInput

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

Thirteen Stars

Re: Result of tOracleInput

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

Manohar B
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")) );
Thirteen 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
Thirteen Stars

Re: Result of tOracleInput

@tanvi_patil,since you can do in tMap.

Manohar B
Five Stars

Re: Result of tOracleInput

thank you so much @manodwhb

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.