Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Problem with Result of sql query and how to add him to an other sql query

Hello again, I have now a sql query , but it return 7 or 8 query instead of 5

And and my query is not returning a result, he return me only the full query

SELECT   * FROM table  where   C_USER_A=(SELECT max(C_USER) as c_user FROM user WHERE  name= 'this.name')

I want to execute the query , how should i do ?

 

0683p000009LrXz.png

String name;
String resultat= ((String)globalMap.get("tOracleRow_2_QUERY"))+'(' + ((String)globalMap.get("tOracleRow_1_QUERY"))+')';
System.out.print(resultat);

 

this is my java code 

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Hi,
Compare the datatype for the columns returned by the "select *" with the datatype defined for the schema.
Also, the columns order in the schema must be aligned with the order columns for the select.

View solution in original post

4 Replies
TRF
Champion II
Champion II

Hi again,

What do you expect from the tJava component.

Remember this rule from the documentation:

"You can use a tJava component to integrate your custom Java code into a Talend program. It applies exclusively to the start of the generated code of the subjob: it will be executed first, but only once in the subjob. Normally, tJava has no input or output data flow and is used as a separate subjob."

What is the result from the "print" operation? 

Anonymous
Not applicable
Author

 

SELECT   * FROM MY_TABLE  where   MY_TABLE.my_row  =(SELECT max(USER.rows) as rows FROM USER WHERE  USER.name = 'name1')
SELECT   * FROM MY_TABLE  where   MY_TABLE.my_row  =(SELECT max(USER.rows) as rows FROM USER WHERE  USER.name = 'name2')
SELECT   * FROM MY_TABLE  where   MY_TABLE.my_row  =(SELECT max(USER.rows) as rows FROM USER WHERE  USER.name = 'name3')
SELECT   * FROM MY_TABLE  where   MY_TABLE.my_row  =(SELECT max(USER.rows) as rows FROM USER WHERE  USER.name = 'name4')
SELECT   * FROM MY_TABLE  where   MY_TABLE.my_row  =(SELECT max(USER.rows) as rows FROM USER WHERE  USER.name = 'name5')
SELECT   * FROM MY_TABLE  where   MY_TABLE.my_row  =(SELECT max(USER.rows) as rows FROM USER WHERE  USER.name = 'name6')
SELECT   * FROM MY_TABLE  where   MY_TABLE.my_row  =(SELECT max(USER.rows) as rows FROM USER WHERE  USER.name = 'name7')
SELECT   * FROM MY_TABLE  where   MY_TABLE.my_row  =(SELECT max(USER.rows) as rows FROM USER WHERE  USER.name = 'name8')
SELECT   * FROM MY_TABLE  where   MY_TABLE.my_row  =(SELECT max(USER.rows) as rows FROM USER WHERE  USER.name = 'name9')

The java print return this

 

In my Job, I want to get the user.rows and adding this to an other sql query to insert an element to my DB

 

I don't know how can I see the result of my query, I tried with tOracleInput but he say me Error "ORA-01722"

TRF
Champion II
Champion II

Hi,
Compare the datatype for the columns returned by the "select *" with the datatype defined for the schema.
Also, the columns order in the schema must be aligned with the order columns for the select.
TRF
Champion II
Champion II

Hi,

Does this help?

If so, thank's to mark your case as solved (Kudos also accepted).