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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] How to handle zero record output from tMysqlInput

Hi,
I have a job that is set to truncate records from a set of tables based on a specific id.
The first time this job is run, the table that contains the specific id is empty.
In other words there is no specific id against which data from the other tables is to be deleted.
The job flow is as follows:
tMysqlConnection_1--OnSubjobOk-->tMysqlInput_1--row1(Main)-->tFlowToIterate_1--Iterate-->tMysqlInput2--row2(Main)-->tFlowToIterate_2--Iterate-->tSQLTemplate_1--OnComponentOk-->tSQLTemplateCommit_1--OnSubjobOk-->tMysqlRow_1
In this case, I get the following error code:
Exception in component tSQLTemplate_1
java.sql.BatchUpdateException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null WHERE run_id=null' at line 1
at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:1193)
at crm_staging.truncatestaging2_0_1.TruncateStaging2.tSQLTemplate_1Process(TruncateStaging2.java:1438)
at crm_staging.truncatestaging2_0_1.TruncateStaging2.runJobInTOS(TruncateStaging2.java:1962)
at crm_staging.truncatestaging2_0_1.TruncateStaging2.main(TruncateStaging2.java:1789)
Is there a way to check if the first tMysqlInput has returned any records?
And if there are no records simply terminate the job.
Also when I add tMysqlClose to the end of the job, it fails at tSQLTemplate stating that the recordset is already closed? Is it because I am using 2 tMysqlInput?
Labels (4)
10 Replies
Anonymous
Not applicable
Author

No Sabrina.... no progress on the issue... we decided to insert a dummy id in the database table to avoid the "null" record error.