<?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 using execute immediate in toraclerow with single quotes in query in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/using-execute-immediate-in-toraclerow-with-single-quotes-in/m-p/2375190#M137658</link>
    <description>i am trying to execute create table statement in toraclerow component using execute immediate statement. create table statement contains code for creating partitions in which partition is done by date 
&lt;BR /&gt;(PARTITION M201002 VALUES LESS THAN (TO_DATE(' 2010-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M9p6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134116iFBD5D7F21624A744/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M9p6.png" alt="0683p000009M9p6.png" /&gt;&lt;/span&gt;S', 'NLS_CALENDAR=GREGORIAN')) and this code has single quotes. 
&lt;BR /&gt;when we use execute immediate we elclose the code in single quotes but the code which i am executing has single quotes so can any body suggest a way to do this? 
&lt;BR /&gt;declare 
&lt;BR /&gt;v_cnt number :=0; 
&lt;BR /&gt;begin 
&lt;BR /&gt;select count(*) into v_cnt from user_tables where table_name='tab1'; 
&lt;BR /&gt;if v_cnt &amp;gt; 0 then 
&lt;BR /&gt;execute immediate 'truncate table tab1'; 
&lt;BR /&gt;else 
&lt;BR /&gt;execute immediate 'create table statement with partition'; 
&lt;BR /&gt;end if; 
&lt;BR /&gt;end;</description>
    <pubDate>Wed, 21 Aug 2013 11:18:14 GMT</pubDate>
    <dc:creator>_AnonymousUser</dc:creator>
    <dc:date>2013-08-21T11:18:14Z</dc:date>
    <item>
      <title>using execute immediate in toraclerow with single quotes in query</title>
      <link>https://community.qlik.com/t5/Talend-Studio/using-execute-immediate-in-toraclerow-with-single-quotes-in/m-p/2375190#M137658</link>
      <description>i am trying to execute create table statement in toraclerow component using execute immediate statement. create table statement contains code for creating partitions in which partition is done by date 
&lt;BR /&gt;(PARTITION M201002 VALUES LESS THAN (TO_DATE(' 2010-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M9p6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134116iFBD5D7F21624A744/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M9p6.png" alt="0683p000009M9p6.png" /&gt;&lt;/span&gt;S', 'NLS_CALENDAR=GREGORIAN')) and this code has single quotes. 
&lt;BR /&gt;when we use execute immediate we elclose the code in single quotes but the code which i am executing has single quotes so can any body suggest a way to do this? 
&lt;BR /&gt;declare 
&lt;BR /&gt;v_cnt number :=0; 
&lt;BR /&gt;begin 
&lt;BR /&gt;select count(*) into v_cnt from user_tables where table_name='tab1'; 
&lt;BR /&gt;if v_cnt &amp;gt; 0 then 
&lt;BR /&gt;execute immediate 'truncate table tab1'; 
&lt;BR /&gt;else 
&lt;BR /&gt;execute immediate 'create table statement with partition'; 
&lt;BR /&gt;end if; 
&lt;BR /&gt;end;</description>
      <pubDate>Wed, 21 Aug 2013 11:18:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/using-execute-immediate-in-toraclerow-with-single-quotes-in/m-p/2375190#M137658</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2013-08-21T11:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: using execute immediate in toraclerow with single quotes in query</title>
      <link>https://community.qlik.com/t5/Talend-Studio/using-execute-immediate-in-toraclerow-with-single-quotes-in/m-p/2375191#M137659</link>
      <description>Hi 
&lt;BR /&gt;I did't test, but you can try to add to add \ to escape the single quote in the partition if you get problem to execute this query with tOracleRow, for example 
&lt;BR /&gt;(PARTITION M201002 VALUES LESS THAN (TO_DATE(\' 2010-03-01 00:00:00\', \'SYYYY-MM-DD HH24:MI 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M9p6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134116iFBD5D7F21624A744/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M9p6.png" alt="0683p000009M9p6.png" /&gt;&lt;/span&gt;S\', \'NLS_CALENDAR=GREGORIAN\')) 
&lt;BR /&gt;An alternative way is to create a store procedure and use tOracleSP to call this store procedure. 
&lt;BR /&gt;Shong</description>
      <pubDate>Thu, 22 Aug 2013 15:06:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/using-execute-immediate-in-toraclerow-with-single-quotes-in/m-p/2375191#M137659</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-22T15:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: using execute immediate in toraclerow with single quotes in query</title>
      <link>https://community.qlik.com/t5/Talend-Studio/using-execute-immediate-in-toraclerow-with-single-quotes-in/m-p/2375192#M137660</link>
      <description>Hello, 
&lt;BR /&gt;Not being sure if this is what you are looking for from your original post - but just in case: at Oracle level, simple quotes contained in string constants should be Oracle-style escaped (by doubling the simple quote), or the string should be specified with the quote operator. 
&lt;BR /&gt;e.g.: (within Oracle, so for example whilst entering a statement in sqlplus or creating a pl/sql procedure in the database) 
&lt;BR /&gt;execute immediate 'update mytab set mycol=select 'a' '; =&amp;gt; error (parsed as two strings separated by the letter "a") 
&lt;BR /&gt;execute immediate 'update mytab set mycol=select ''a'' '; =&amp;gt; ok (each simple quote inside the string is escaped by being doubled) 
&lt;BR /&gt;execute immediate q'$update mytab set mycol=select 'a'$' =&amp;gt; ok in recent versions of Oracle (q is the quote operator) 
&lt;BR /&gt;About the latter method : q'$ starting a string (instead of just a simple quote) means that: 
&lt;BR /&gt;* the string end is now expected to be $' instead of just a simple quote 
&lt;BR /&gt;* any simple quote in between loses its usual end-of-string delimiter role. 
&lt;BR /&gt;Note that there are additional possibilities (other characters than $ can be used,...) - see Oracle documentation for full details. 
&lt;BR /&gt;And actually, combining this with the previous comment, in tOracleRow you may end up having to do something like: (I won't be able to test this myself for the moment, sorry!) 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;execute immediate \' ....&lt;BR /&gt;(PARTITION M201002 VALUES LESS THAN (TO_DATE(\'\' 2010-03-01 00:00:00\'\', \'\'SYYYY-MM-DD HH24:MI&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M9p6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134116iFBD5D7F21624A744/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M9p6.png" alt="0683p000009M9p6.png" /&gt;&lt;/span&gt;S\'\', \'\'NLS_CALENDAR=GREGORIAN\'\')) .... \'&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;My apologies if this was obvious to you already ! 
&lt;BR /&gt;Didier</description>
      <pubDate>Thu, 22 Aug 2013 16:11:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/using-execute-immediate-in-toraclerow-with-single-quotes-in/m-p/2375192#M137660</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-22T16:11:32Z</dc:date>
    </item>
  </channel>
</rss>

