Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am looking to do something for the first time in Talend. I need to store the results of a SQL query in several global variables. Let me explain. The query below returns 4 values positioned in line in Oracle. In Talend, I would obviously have the same result. What I want to do is store each value in a global variable, but it's difficult to do that knowing that they are returned in a column.
I'm thinking that maybe I need to create a different SQL query to get the 4 rows in 4 columns, but I don't see how at the moment. But I wonder if there is a Talend component that can convert 4 rows into 4 columns, which I think can help me.
Do you have an idea? I am thinking of creating the global variables using a tFlowToIterate or tSetGlobalVar, I don't know which is better.
Hi
I don't understand what's the purpose of storing the value into global variables, however, if you want to have the output like this
c1;c2;c3;c4
484287;4044301;1
You can use tDenormalize+tExtractDelimitedFields to achieve it after reading these 4 rows from DB.
Regards
Shong
Hello @Shicong Hong ,
Thanks, I will try your solution. I need to store these 4 values in a global variable for each because they are input parameters I need for a procedure (tDBSP). The reason why I need to get them this way.
Yes, after you convert rows to columns, you can store the each value to different global variables on tJavaRow for used later, but you just want to pass these value to tDBSP as input parameters, passing directly them from tExtractDelimitedFields to tDBSP without global variables, you can select the columns on tDBSP.
You could try that too, allow to call Global var by their name.
flowinput is here to simulate the db component, use newcolumn1 and newcolumn as colum name.