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

Seven Stars

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 ?

 

toos.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 


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

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

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

All Replies
Fifteen Stars TRF
Fifteen Stars

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

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? 


TRF
Seven Stars

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

 

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"

Fifteen Stars TRF
Fifteen Stars

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

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
Fifteen Stars TRF
Fifteen Stars

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

Hi,

Does this help?

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


TRF

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

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

Download