Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to use java var on SQL query ?

Hello,  I have on my tXMLMap,some values , and with this values, I would like to make a sql query to get the id on the table and insert this id to an another SQL query .

First, I used tSetGlobalVar, but in my sql query ( Oracle Row) it doing nothing.

My query is like

"SELECT max(my_table_name) as table_id FROM table WHERE  table.name =' " + id  + "' 

ID was the name of my SetGlobalVar , I use

StringHandling.UPCASE(row2.USERNAME) 

for the Value

 

 

How can I use the query and insert into the tOracleOutput ? 0683p000009LsYN.png

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

You can connect your tOracle(or other DB)Input component to a tSetGlobalVar to get the result into a new global variable.

Then, or you use a tOracleRow and you introduce the query by yourself (using the preceding global variable).

You map also use a standard tOracleOutput component for which the desired field will be populated with the global variable content (probably in a tMap or tJavaRow).

 

Thank's to mark your case as solved and open a new one for new or derived questions.

View solution in original post

3 Replies
TRF
Champion II
Champion II

Hi,

If you have a global variable called "id" you have to change your query like this one:

"SELECT max(my_table_name) as table_id FROM table WHERE  table.name = '" + (String)globalMap.get("id")  + "'"

Hope this helps.

 

Anonymous
Not applicable
Author

Hello, and thanks for the solution, its working, but now, I want to get this result of my query and add to the other query  Its be like

Insert into my_table (table1,table2table3) 
Values("Her the result of my first query","test",1)
TRF
Champion II
Champion II

You can connect your tOracle(or other DB)Input component to a tSetGlobalVar to get the result into a new global variable.

Then, or you use a tOracleRow and you introduce the query by yourself (using the preceding global variable).

You map also use a standard tOracleOutput component for which the desired field will be populated with the global variable content (probably in a tMap or tJavaRow).

 

Thank's to mark your case as solved and open a new one for new or derived questions.