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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Run sql query from text file

How can we pass sql query using text file and load sql query output in output file ?

I have tried by storing query in context and then called that context in tOracleinput but it is throwing some error.

Exception in component tOracleInput_1
java.sql.SQLException: Invalid SQL type: sqlKind = UNINITIALIZED

Kindly suggest what can be done to resolve the issue.

Labels (3)
4 Replies
Anonymous
Not applicable
Author

Hi,

 

    Please note that the assumption is that you are querying the table with same schema to extract the data based on query. If there is schema change, you cannot do data extraction using this method.

1) Add query and table name in the input file and read them as showing below .

 

0683p000009M3Be.png

 

2) The schema is as shown below and pass them to tFlowtoIterate

0683p000009M3Bj.png

 

The data from the tFlowtoIterate will be added to tOracleInput as shown below.

0683p000009M33v.png

 

Provided the schema remains same, the data will be loaded to output file. If you need to load them to different files, you can pass the target file path also as additional parameter to tFLowtoIterate and add them in the file path of output file.

 

I hope I have answered your query 🙂

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

 

 

Anonymous
Not applicable
Author

Hi Nikhil

I have tried your approach to execute sql query but getting error

Exception in component tOracleInput_1
java.sql.SQLException: SQL statement to execute cannot be empty or null

 

I am passing valid query in text file.

 

Thanks for the solution.

 

Anonymous
Not applicable
Author

Hi,

 

   Could you please print and see whether the tFlowtoIterate is having right values?

 

   You can use a System Print inside tjava after tFlowtoiterate to see the results.

 

   It seems the value in your query variable is null or empty. Also add tlogrow in each stage to identify the exact area where data loss is happening.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

 

It is giving null or blank error when i am unchecking tflowtoiterate use the default (key, value) in global variable option.

But when i am using this default option it is giving same error i was getting initially.

 

Exception in component tOracleInput_1
java.sql.SQLException: Invalid SQL type: sqlKind = UNINITIALIZED

 

column name for query used is ->> dbQuery

Variable in toracleinput is --> ((String)globalMap.get("row3.dbQuery"))

Tell me if i am missing something.