<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic [resolved] How to handle zero record output from tMysqlInput in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316687#M87209</link>
    <description>Hi, 
&lt;BR /&gt;I have a job that is set to truncate records from a set of tables based on a specific id. 
&lt;BR /&gt;The first time this job is run, the table that contains the specific id is empty. 
&lt;BR /&gt;In other words there is no specific id against which data from the other tables is to be deleted. 
&lt;BR /&gt;The job flow is as follows: 
&lt;BR /&gt;tMysqlConnection_1--OnSubjobOk--&amp;gt;tMysqlInput_1--row1(Main)--&amp;gt;tFlowToIterate_1--Iterate--&amp;gt;tMysqlInput2--row2(Main)--&amp;gt;tFlowToIterate_2--Iterate--&amp;gt;tSQLTemplate_1--OnComponentOk--&amp;gt;tSQLTemplateCommit_1--OnSubjobOk--&amp;gt;tMysqlRow_1 
&lt;BR /&gt;In this case, I get the following error code: 
&lt;BR /&gt;Exception in component tSQLTemplate_1 
&lt;BR /&gt;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 
&lt;BR /&gt; at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:1193) 
&lt;BR /&gt; at crm_staging.truncatestaging2_0_1.TruncateStaging2.tSQLTemplate_1Process(TruncateStaging2.java:1438) 
&lt;BR /&gt; at crm_staging.truncatestaging2_0_1.TruncateStaging2.runJobInTOS(TruncateStaging2.java:1962) 
&lt;BR /&gt; at crm_staging.truncatestaging2_0_1.TruncateStaging2.main(TruncateStaging2.java:1789) 
&lt;BR /&gt;Is there a way to check if the first tMysqlInput has returned any records? 
&lt;BR /&gt;And if there are no records simply terminate the job. 
&lt;BR /&gt;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?</description>
    <pubDate>Thu, 26 Jun 2014 09:39:30 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-06-26T09:39:30Z</dc:date>
    <item>
      <title>[resolved] How to handle zero record output from tMysqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316687#M87209</link>
      <description>Hi, 
&lt;BR /&gt;I have a job that is set to truncate records from a set of tables based on a specific id. 
&lt;BR /&gt;The first time this job is run, the table that contains the specific id is empty. 
&lt;BR /&gt;In other words there is no specific id against which data from the other tables is to be deleted. 
&lt;BR /&gt;The job flow is as follows: 
&lt;BR /&gt;tMysqlConnection_1--OnSubjobOk--&amp;gt;tMysqlInput_1--row1(Main)--&amp;gt;tFlowToIterate_1--Iterate--&amp;gt;tMysqlInput2--row2(Main)--&amp;gt;tFlowToIterate_2--Iterate--&amp;gt;tSQLTemplate_1--OnComponentOk--&amp;gt;tSQLTemplateCommit_1--OnSubjobOk--&amp;gt;tMysqlRow_1 
&lt;BR /&gt;In this case, I get the following error code: 
&lt;BR /&gt;Exception in component tSQLTemplate_1 
&lt;BR /&gt;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 
&lt;BR /&gt; at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:1193) 
&lt;BR /&gt; at crm_staging.truncatestaging2_0_1.TruncateStaging2.tSQLTemplate_1Process(TruncateStaging2.java:1438) 
&lt;BR /&gt; at crm_staging.truncatestaging2_0_1.TruncateStaging2.runJobInTOS(TruncateStaging2.java:1962) 
&lt;BR /&gt; at crm_staging.truncatestaging2_0_1.TruncateStaging2.main(TruncateStaging2.java:1789) 
&lt;BR /&gt;Is there a way to check if the first tMysqlInput has returned any records? 
&lt;BR /&gt;And if there are no records simply terminate the job. 
&lt;BR /&gt;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?</description>
      <pubDate>Thu, 26 Jun 2014 09:39:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316687#M87209</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-26T09:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to handle zero record output from tMysqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316688#M87210</link>
      <description>Hi, 
&lt;BR /&gt;If I understand your requirement well, you can use "Run if" trigger in your work flow. 
&lt;BR /&gt; 
&lt;A href="https://help.talend.com/search/all?query=Connection+types&amp;amp;content-lang=en" target="_blank" rel="nofollow noopener noreferrer"&gt;TalendHelpCenter:Connection types&lt;/A&gt;. 
&lt;BR /&gt;Please see my screenshots for details. Feel free to let me know if I miss or misunderstand something. 
&lt;BR /&gt;Best regards 
&lt;BR /&gt;Sabrina 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009METN.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133516i50C2AE9D78A3EB90/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009METN.png" alt="0683p000009METN.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MEDm.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/142173iF7D5E2EF77FD71F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MEDm.png" alt="0683p000009MEDm.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Fri, 27 Jun 2014 04:43:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316688#M87210</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-27T04:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to handle zero record output from tMysqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316689#M87211</link>
      <description>Thanks Sabrina for this solution.&lt;BR /&gt;But unfortunately it does not work.&lt;BR /&gt;It still gives an error at the tSQLTemplate_1 component if there are no records in the ID database table.&lt;BR /&gt;Also if there are multiple IDs, then the iteration is executed only for the last ID retrieved from the first tMysqlInput component.</description>
      <pubDate>Fri, 27 Jun 2014 10:45:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316689#M87211</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-27T10:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to handle zero record output from tMysqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316690#M87212</link>
      <description>Hi ketan,&lt;BR /&gt;Have you checked COALESCE function for your use?&lt;BR /&gt;Vaibhav</description>
      <pubDate>Fri, 27 Jun 2014 10:50:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316690#M87212</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-27T10:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to handle zero record output from tMysqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316691#M87213</link>
      <description>@Vaibhav: Can you elaborate please?</description>
      <pubDate>Fri, 27 Jun 2014 10:55:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316691#M87213</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-27T10:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to handle zero record output from tMysqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316692#M87214</link>
      <description>hi all, 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;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&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;first you have to correct sql syntax 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MA9p.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138034i5F552429DA646D6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MA9p.png" alt="0683p000009MA9p.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;regards 
&lt;BR /&gt;laurent</description>
      <pubDate>Fri, 27 Jun 2014 10:55:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316692#M87214</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-27T10:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to handle zero record output from tMysqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316693#M87215</link>
      <description>@Laurent: the SQL syntax is correct. 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;The "null" is coming from the tMysqlInput components in the job as there no records retrieved from the database table. 
&lt;BR /&gt;I want the job to stop if there are no records to be processed.</description>
      <pubDate>Fri, 27 Jun 2014 11:02:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316693#M87215</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-27T11:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to handle zero record output from tMysqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316694#M87216</link>
      <description>ohhh sorry 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MA9p.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138034i5F552429DA646D6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MA9p.png" alt="0683p000009MA9p.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;count number of row Before with a tMysqlRow and use if trigger depending if result = 0 or not ... 
&lt;BR /&gt;hope it helps 
&lt;BR /&gt;regards 
&lt;BR /&gt;laurent</description>
      <pubDate>Fri, 27 Jun 2014 11:07:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316694#M87216</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-27T11:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to handle zero record output from tMysqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316695#M87217</link>
      <description>Hi ketan,
&lt;BR /&gt;Use coalesce function inside your tmysqlinput, use tjavarow to set the incoming row value to some context variable.
&lt;BR /&gt;Use if flow from tMySQLOutput and check if the context variable value == 0 if then connect it to tdie...
&lt;BR /&gt;Or use inside tJavarow to perform null handling like below
&lt;BR /&gt;context.your_column = Relational.ISNULL(input_row.yourcolumn)?0:input_row.yourcolumn;
&lt;BR /&gt;Vaibhav</description>
      <pubDate>Fri, 27 Jun 2014 11:49:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316695#M87217</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-27T11:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to handle zero record output from tMysqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316696#M87218</link>
      <description>Hi ketan.chachad, 
&lt;BR /&gt;Is there any update for your issue? 
&lt;BR /&gt;Best regards
&lt;BR /&gt;Sabrina</description>
      <pubDate>Mon, 30 Jun 2014 11:24:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316696#M87218</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-30T11:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to handle zero record output from tMysqlInput</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316697#M87219</link>
      <description>No Sabrina.... no progress on the issue... we decided to insert a dummy id in the database table to avoid the "null" record error.</description>
      <pubDate>Mon, 30 Jun 2014 11:36:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-handle-zero-record-output-from-tMysqlInput/m-p/2316697#M87219</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-30T11:36:00Z</dc:date>
    </item>
  </channel>
</rss>

