<?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: Dynamic SQL for deleting rows in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375164#M137637</link>
    <description>&lt;P&gt;But in which component do I set these context variables? Do I have to use a tJavaRow after the tOracleInput with: contex.&amp;lt;..&amp;gt; = input_row.&amp;lt;..&amp;gt; and how do I have to connect these 3 components that it'll work afterwards? With tJavaRow I can't use the iterate-connection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx for your answer!&lt;/P&gt;&lt;P&gt;Lisa&lt;/P&gt;</description>
    <pubDate>Fri, 19 Nov 2021 08:01:22 GMT</pubDate>
    <dc:creator>HeinrichL</dc:creator>
    <dc:date>2021-11-19T08:01:22Z</dc:date>
    <item>
      <title>Dynamic SQL for deleting rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375162#M137635</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm struggeling with designing a dynamic SQL for deleting rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a tOracleInput component for selecting the rows I want to delete. My select is:&lt;/P&gt;&lt;P&gt;"select distinct DEL_ID,DEL_TAB,DEL_FIELD from &amp;lt;..&amp;gt;  where DEL_KZ Is NUll order by DEL_TAB,DEL_FIELD,DEL_ID;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For deleting I wanted to use TOracleRow with the delete statement: &lt;/P&gt;&lt;P&gt;"delete from input_row.del_tab&amp;nbsp;where input_row.del_field = input_row.DEL_ID;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I connected both components with iterate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Del_Tab and Del_Field can be different so I want it dynamical. Do i have to use other components oder other connections? Should I save del_tab &amp;amp; del_field in a context variable? By starting the job I get the exception: &lt;/P&gt;&lt;P&gt;ORA-00933: SQL command not properly ended&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx for helping!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 13:56:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375162#M137635</guid>
      <dc:creator>HeinrichL</dc:creator>
      <dc:date>2021-11-18T13:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL for deleting rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375163#M137636</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;You could set context variables for that job in tOracleRow component.&lt;/P&gt;&lt;P&gt;Try this syntax: &lt;/P&gt;&lt;P&gt;"DELETE FROM "+context.del_tab WHERE Del_Field  = "+context.yourvariable&lt;/P&gt;&lt;P&gt;Let us know if it helps.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Sabrina&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 07:24:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375163#M137636</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-19T07:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL for deleting rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375164#M137637</link>
      <description>&lt;P&gt;But in which component do I set these context variables? Do I have to use a tJavaRow after the tOracleInput with: contex.&amp;lt;..&amp;gt; = input_row.&amp;lt;..&amp;gt; and how do I have to connect these 3 components that it'll work afterwards? With tJavaRow I can't use the iterate-connection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx for your answer!&lt;/P&gt;&lt;P&gt;Lisa&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 08:01:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375164#M137637</guid>
      <dc:creator>HeinrichL</dc:creator>
      <dc:date>2021-11-19T08:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL for deleting rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375165#M137638</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think there are a few problems with this query that you're not aware of:&lt;/P&gt;&lt;P&gt;"delete from input_row.del_tab&amp;nbsp;where input_row.del_field = input_row.DEL_ID;"&lt;/P&gt;&lt;P&gt;input_row is supported for tJavaRow component.&lt;/P&gt;&lt;P&gt;It should look more like:&lt;/P&gt;&lt;P&gt;"delete from " + row1.del_tab&amp;nbsp;+ " where " + row1.del_field +" = " + row1.DEL_ID+ ";"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will work OK for a few records. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For millions of records you probably want to use the "Use PreparedStatement" option under advanced settings. &lt;/P&gt;&lt;P&gt;This you would require to group the tables + fields, and introduce tFlowToIterate . &lt;/P&gt;&lt;P&gt;"select distinct DEL_TAB,DEL_FIELD from &amp;lt;..&amp;gt; where DEL_KZ Is NUll "  -&amp;gt;tFlowToIterate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your current input would become:&lt;/P&gt;&lt;P&gt;"select distinct DEL_ID,DEL_TAB,DEL_FIELD from &amp;lt;..&amp;gt; where DEL_KZ Is NUll AND WHERE DEL_TAB = '" + ((String)globalMap.get("table")) + "' AND DEL_FIELD = '" + ((String)globalMap.get("field")) +"' order by DEL_TAB,DEL_FIELD,DEL_ID;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then your query in the Row could become:&lt;/P&gt;&lt;P&gt;"delete from " + ((String)globalMap.get("table"))+ " where " + ((String)globalMap.get("field")) +" =&lt;B&gt;  ? &lt;/B&gt;;"&lt;/P&gt;&lt;P&gt;Here the parameters will be passed under Advanced Settings:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000L115DAAR.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/152885iBE63381C1B3982A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000L115DAAR.png" alt="0695b00000L115DAAR.png" /&gt;&lt;/span&gt;This would make the query execution faster but the statement will be prepared at the beginning of the subjob so you need iteration / loops. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 09:53:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375165#M137638</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-19T09:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL for deleting rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375166#M137639</link>
      <description>&lt;P&gt;Thx for the detailed answer! I try that later and let u know if it worked.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 10:50:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375166#M137639</guid>
      <dc:creator>HeinrichL</dc:creator>
      <dc:date>2021-11-19T10:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL for deleting rows</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375167#M137640</link>
      <description>&lt;P&gt;What do you mean by saying I need iteration/loops? &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I configured my components like you said. &lt;/P&gt;&lt;P&gt;Here is the input:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000L1IotAAF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/153730iE5248875F67BA30E/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000L1IotAAF.png" alt="0695b00000L1IotAAF.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the tDBRow:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000L1IpDAAV.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/142564iAC698A4117431475/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000L1IpDAAV.png" alt="0695b00000L1IpDAAV.png" /&gt;&lt;/span&gt;For this I added a parameter:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000L1IsvAAF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/150883i127B8992B345D58D/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000L1IsvAAF.png" alt="0695b00000L1IsvAAF.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I get an error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000L1ItFAAV.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/147113iA24388F8085F5A47/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000L1ItFAAV.png" alt="0695b00000L1ItFAAV.png" /&gt;&lt;/span&gt;&lt;U&gt;java.sql.sqlsyntaxerrorexception ora-00933 sql command not properly ended&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me with that @Balazs Gunics​&amp;nbsp;?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 10:59:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-SQL-for-deleting-rows/m-p/2375167#M137640</guid>
      <dc:creator>HeinrichL</dc:creator>
      <dc:date>2021-11-22T10:59:08Z</dc:date>
    </item>
  </channel>
</rss>

