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.
Solved! Go to Solution.
@tanvi_patil,you can store the result into global variable using tSetGlobalvar and using get (String)globalMap.get() method you can get.
@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
@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"))
@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")) );
Introduction to Talend Open Studio for Data Integration.
Practical steps to developing your data integration strategy.
Create systems and workflow to manage clean data ingestion and data transformation.