<?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 Re: SQL Template usage in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/SQL-Template-usage/m-p/2332071#M100990</link>
    <description>Sorry, I was unable to post the attachement.&lt;BR /&gt;I am using:&lt;BR /&gt;-------------------------&lt;BR /&gt;tNetezzaConnection_1 --&amp;gt; tSQLTemplate_1 --&amp;gt; tNetezzaClose_1&lt;BR /&gt;-------------------------&lt;BR /&gt;The tSQLTemplate_1 contains one template named "test" with the following content:&lt;BR /&gt;-------------------------&lt;BR /&gt;#sql sentence&lt;BR /&gt;DROP TABLE temp_0;&lt;BR /&gt;&amp;lt;%&lt;BR /&gt;#loop&lt;BR /&gt;for(int i=1; i&amp;lt;10; i++){&lt;BR /&gt;%&amp;gt;&lt;BR /&gt;#sql sentence&lt;BR /&gt;DROP TABLE temp_&amp;lt;%=i %&amp;gt;;&lt;BR /&gt;&amp;lt;%&lt;BR /&gt;}&lt;BR /&gt;%&amp;gt;&lt;BR /&gt;#sql sentence&lt;BR /&gt;DROP TABLE temp_10;&lt;BR /&gt;-------------------------&lt;BR /&gt;The generated code causes error because of this (multiple occurrences of tempSQLSentence_tSQLTemplate_1_1):&lt;BR /&gt;-------------------------&lt;BR /&gt;				String tempSQLSentence_tSQLTemplate_1_1 = "DROP TABLE temp_0";&lt;BR /&gt;				globalMap.put("tSQLTemplate_1_QUERY",&lt;BR /&gt;						tempSQLSentence_tSQLTemplate_1_1);&lt;BR /&gt;				stmt_tSQLTemplate_1.addBatch(tempSQLSentence_tSQLTemplate_1_1);&lt;BR /&gt;				for (int i = 1; i &amp;lt; 10; i++) {&lt;BR /&gt;					String tempSQLSentence_tSQLTemplate_1_1 = "DROP TABLE temp_"&lt;BR /&gt;							+ i + "";&lt;BR /&gt;					globalMap.put("tSQLTemplate_1_QUERY",&lt;BR /&gt;							tempSQLSentence_tSQLTemplate_1_1);&lt;BR /&gt;					stmt_tSQLTemplate_1&lt;BR /&gt;							.addBatch(tempSQLSentence_tSQLTemplate_1_1);&lt;BR /&gt;				}&lt;BR /&gt;				String tempSQLSentence_tSQLTemplate_1_1 = "DROP TABLE temp_10";&lt;BR /&gt;-------------------------</description>
    <pubDate>Tue, 08 Jul 2014 16:47:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-07-08T16:47:11Z</dc:date>
    <item>
      <title>SQL Template usage</title>
      <link>https://community.qlik.com/t5/Talend-Studio/SQL-Template-usage/m-p/2332070#M100989</link>
      <description>Hello, 
&lt;BR /&gt;I am using Talend Enterprise Big Data 5.4.1, but I think this question is related to the Studio in general. 
&lt;BR /&gt;I am trying to use SQL Templates and I am having troubles with templates containing multiple statements. 
&lt;BR /&gt;You can see on the screenshot an example where I tried to use a template from the documentation (Talend Studio user guide, Appendix C). 
&lt;BR /&gt;It causes following exception during job generation: Duplicate local variable tempSQLSentence_tSQLTemplate_1_1. 
&lt;BR /&gt;If I look at the generated code, it generates string variables containing the statements, but all are named the same for all statements in one template. 
&lt;BR /&gt;Is this a bug or am I doing something wrong (maybe wrong tSQLTemplate* component)? 
&lt;BR /&gt;In documentation, it is explicitely stated that a template can contain multiple statements. 
&lt;BR /&gt;As a second question, I am curious - in case the multiple statements in one template work - if it is possible to use SQL Templates as a method of executing "any" SQL script (put it into SQL template, then execute via the tSQLTemplate component) - e.g. without using any SQL Template variables etc. 
&lt;BR /&gt;Thanks 
&lt;BR /&gt;Jan</description>
      <pubDate>Sat, 16 Nov 2024 11:35:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/SQL-Template-usage/m-p/2332070#M100989</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T11:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Template usage</title>
      <link>https://community.qlik.com/t5/Talend-Studio/SQL-Template-usage/m-p/2332071#M100990</link>
      <description>Sorry, I was unable to post the attachement.&lt;BR /&gt;I am using:&lt;BR /&gt;-------------------------&lt;BR /&gt;tNetezzaConnection_1 --&amp;gt; tSQLTemplate_1 --&amp;gt; tNetezzaClose_1&lt;BR /&gt;-------------------------&lt;BR /&gt;The tSQLTemplate_1 contains one template named "test" with the following content:&lt;BR /&gt;-------------------------&lt;BR /&gt;#sql sentence&lt;BR /&gt;DROP TABLE temp_0;&lt;BR /&gt;&amp;lt;%&lt;BR /&gt;#loop&lt;BR /&gt;for(int i=1; i&amp;lt;10; i++){&lt;BR /&gt;%&amp;gt;&lt;BR /&gt;#sql sentence&lt;BR /&gt;DROP TABLE temp_&amp;lt;%=i %&amp;gt;;&lt;BR /&gt;&amp;lt;%&lt;BR /&gt;}&lt;BR /&gt;%&amp;gt;&lt;BR /&gt;#sql sentence&lt;BR /&gt;DROP TABLE temp_10;&lt;BR /&gt;-------------------------&lt;BR /&gt;The generated code causes error because of this (multiple occurrences of tempSQLSentence_tSQLTemplate_1_1):&lt;BR /&gt;-------------------------&lt;BR /&gt;				String tempSQLSentence_tSQLTemplate_1_1 = "DROP TABLE temp_0";&lt;BR /&gt;				globalMap.put("tSQLTemplate_1_QUERY",&lt;BR /&gt;						tempSQLSentence_tSQLTemplate_1_1);&lt;BR /&gt;				stmt_tSQLTemplate_1.addBatch(tempSQLSentence_tSQLTemplate_1_1);&lt;BR /&gt;				for (int i = 1; i &amp;lt; 10; i++) {&lt;BR /&gt;					String tempSQLSentence_tSQLTemplate_1_1 = "DROP TABLE temp_"&lt;BR /&gt;							+ i + "";&lt;BR /&gt;					globalMap.put("tSQLTemplate_1_QUERY",&lt;BR /&gt;							tempSQLSentence_tSQLTemplate_1_1);&lt;BR /&gt;					stmt_tSQLTemplate_1&lt;BR /&gt;							.addBatch(tempSQLSentence_tSQLTemplate_1_1);&lt;BR /&gt;				}&lt;BR /&gt;				String tempSQLSentence_tSQLTemplate_1_1 = "DROP TABLE temp_10";&lt;BR /&gt;-------------------------</description>
      <pubDate>Tue, 08 Jul 2014 16:47:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/SQL-Template-usage/m-p/2332071#M100990</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-07-08T16:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Template usage</title>
      <link>https://community.qlik.com/t5/Talend-Studio/SQL-Template-usage/m-p/2332072#M100991</link>
      <description>Hi jan.fabian,
&lt;BR /&gt;did you find solution to the multiple variable instances with the same name?
&lt;BR /&gt;I have the same error: "Duplicate local variable tempSQLSentence_tSQLTemplate_1_1"
&lt;BR /&gt;Thank you,
&lt;BR /&gt;Lorenzo</description>
      <pubDate>Mon, 21 Nov 2016 14:06:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/SQL-Template-usage/m-p/2332072#M100991</guid>
      <dc:creator>Lorenzo5</dc:creator>
      <dc:date>2016-11-21T14:06:53Z</dc:date>
    </item>
  </channel>
</rss>

