<?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: Update Primary Key in Oracle table in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Update-Primary-Key-in-Oracle-table/m-p/2236600#M25279</link>
    <description>&lt;P&gt;Assuming your primary is not Sequence&amp;nbsp; and Your Primary is not Foreign Key of others ,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;As per my suggestion ,You should&amp;nbsp; disable the Primary Constraints ,&lt;/P&gt; 
&lt;PRE&gt;ALTER TABLE table_name
DISABLE CONSTRAINT primary_constraint_name;&lt;/PRE&gt; 
&lt;P&gt;Update Primary&amp;nbsp; Column&amp;nbsp;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Update table_name set pcol = pcol +1 ;&lt;/P&gt; 
&lt;P&gt;Commit;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;enable Primary Key constraints and Analyse it so that Primary Key Index are re-Build correctly.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;ALTER TABLE table_name
ENABLE CONSTRAINT primary_constraint_name;&lt;/PRE&gt; 
&lt;PRE&gt;ANALYZE TABLE table_name VALIDATE STRUCTURE CASCADE FAST;&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Mar 2019 15:19:24 GMT</pubDate>
    <dc:creator>akumar2301</dc:creator>
    <dc:date>2019-03-08T15:19:24Z</dc:date>
    <item>
      <title>Update Primary Key in Oracle table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Update-Primary-Key-in-Oracle-table/m-p/2236599#M25278</link>
      <description>&lt;P&gt;How can I update Primary Key value in Oracle table using Talend?&lt;/P&gt; 
&lt;P&gt;I need to increment the values of the Primary Key by 1 starting from the highest value backwards, so that I don't get duplicates.&lt;/P&gt; 
&lt;P&gt;Example:&lt;/P&gt; 
&lt;P&gt;Key--New Value&lt;/P&gt; 
&lt;P&gt;1--2&lt;/P&gt; 
&lt;P&gt;2--3&lt;/P&gt; 
&lt;P&gt;3--4&lt;/P&gt; 
&lt;P&gt;4--5&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 14:47:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Update-Primary-Key-in-Oracle-table/m-p/2236599#M25278</guid>
      <dc:creator>cd160</dc:creator>
      <dc:date>2019-03-08T14:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Update Primary Key in Oracle table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Update-Primary-Key-in-Oracle-table/m-p/2236600#M25279</link>
      <description>&lt;P&gt;Assuming your primary is not Sequence&amp;nbsp; and Your Primary is not Foreign Key of others ,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;As per my suggestion ,You should&amp;nbsp; disable the Primary Constraints ,&lt;/P&gt; 
&lt;PRE&gt;ALTER TABLE table_name
DISABLE CONSTRAINT primary_constraint_name;&lt;/PRE&gt; 
&lt;P&gt;Update Primary&amp;nbsp; Column&amp;nbsp;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Update table_name set pcol = pcol +1 ;&lt;/P&gt; 
&lt;P&gt;Commit;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;enable Primary Key constraints and Analyse it so that Primary Key Index are re-Build correctly.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;ALTER TABLE table_name
ENABLE CONSTRAINT primary_constraint_name;&lt;/PRE&gt; 
&lt;PRE&gt;ANALYZE TABLE table_name VALIDATE STRUCTURE CASCADE FAST;&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 15:19:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Update-Primary-Key-in-Oracle-table/m-p/2236600#M25279</guid>
      <dc:creator>akumar2301</dc:creator>
      <dc:date>2019-03-08T15:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Update Primary Key in Oracle table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Update-Primary-Key-in-Oracle-table/m-p/2236601#M25280</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LP7CAAW"&gt;@uganesh&lt;/A&gt;&amp;nbsp;for the reply.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I know we can do this using the query below, but I was kind of wondering if there was another way around it in Talend, using less 'written' commands.&lt;/P&gt; 
&lt;P&gt;Here is my dilemma:&lt;/P&gt; 
&lt;P&gt;Table has two columns (Key1, Key2) that go into Primary Key and together create the Unique constraint. Key1 is set as Foreign key for another table.&lt;/P&gt; 
&lt;P&gt;Key1&amp;nbsp; Key2&lt;/P&gt; 
&lt;P&gt;A1&amp;nbsp; 1&lt;/P&gt; 
&lt;P&gt;A1&amp;nbsp; 2&lt;/P&gt; 
&lt;P&gt;A1&amp;nbsp; 3&lt;/P&gt; 
&lt;P&gt;A1&amp;nbsp; 4&lt;/P&gt; 
&lt;P&gt;A2&amp;nbsp; 1&lt;/P&gt; 
&lt;P&gt;A2&amp;nbsp; 2&lt;/P&gt; 
&lt;P&gt;A3&amp;nbsp; 1&lt;/P&gt; 
&lt;P&gt;A3&amp;nbsp; 2&lt;/P&gt; 
&lt;P&gt;A3&amp;nbsp; 3&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I want to increment the values of Key2 by 1 so that the value "1" is available again, because my next step is to insert a new row in my Table with Key2 value "1".&lt;/P&gt; 
&lt;P&gt;A1&amp;nbsp; 1 (new inserted row)&lt;/P&gt; 
&lt;P&gt;A1&amp;nbsp; 2 (old rows with Key2 value incremented)&lt;/P&gt; 
&lt;P&gt;A1&amp;nbsp; 3&lt;/P&gt; 
&lt;P&gt;A1&amp;nbsp; 4&lt;/P&gt; 
&lt;P&gt;A1&amp;nbsp; 5&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;There is no way around using the query I guess?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 07:26:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Update-Primary-Key-in-Oracle-table/m-p/2236601#M25280</guid>
      <dc:creator>cd160</dc:creator>
      <dc:date>2019-03-11T07:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Update Primary Key in Oracle table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Update-Primary-Key-in-Oracle-table/m-p/2236602#M25281</link>
      <description>&lt;P&gt;in this case , TOracleRow ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"begin&lt;/P&gt;
&lt;P&gt;update table1 SET Key2=&amp;nbsp;Key2 + 1&amp;nbsp; WHERE Key1 = 'A1' ;&lt;BR /&gt;Commit ;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Should work.&amp;nbsp; Then you could insert new record with Key2 as 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note : If you need to do it in data flow , better to create a Oracle Trigger.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 09:34:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Update-Primary-Key-in-Oracle-table/m-p/2236602#M25281</guid>
      <dc:creator>akumar2301</dc:creator>
      <dc:date>2019-03-11T09:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Update Primary Key in Oracle table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Update-Primary-Key-in-Oracle-table/m-p/2236603#M25282</link>
      <description>&lt;P&gt;Works! Thank you&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LP7CAAW"&gt;@uganesh&lt;/A&gt;&amp;nbsp;!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 14:06:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Update-Primary-Key-in-Oracle-table/m-p/2236603#M25282</guid>
      <dc:creator>cd160</dc:creator>
      <dc:date>2019-03-12T14:06:39Z</dc:date>
    </item>
  </channel>
</rss>

