<?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 update table in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041403#M754872</link>
    <description>I can not seem to get this to work.&lt;BR /&gt;update table1&lt;BR /&gt;set table1.cola ='PEPSI'&lt;BR /&gt;where table2.feature = 'PEPSI TYPE' &lt;BR /&gt;and table1.master_key = table2.master_key&lt;BR /&gt;&lt;BR /&gt;So I am updating the main table if the second table contains the right data.</description>
    <pubDate>Thu, 19 Apr 2007 11:41:18 GMT</pubDate>
    <dc:creator>Ratzie</dc:creator>
    <dc:date>2007-04-19T11:41:18Z</dc:date>
    <item>
      <title>update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041403#M754872</link>
      <description>I can not seem to get this to work.&lt;BR /&gt;update table1&lt;BR /&gt;set table1.cola ='PEPSI'&lt;BR /&gt;where table2.feature = 'PEPSI TYPE' &lt;BR /&gt;and table1.master_key = table2.master_key&lt;BR /&gt;&lt;BR /&gt;So I am updating the main table if the second table contains the right data.</description>
      <pubDate>Thu, 19 Apr 2007 11:41:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041403#M754872</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2007-04-19T11:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041404#M754873</link>
      <description>Try " instead of '&lt;BR /&gt;&lt;BR /&gt;example "PEPSI"</description>
      <pubDate>Thu, 19 Apr 2007 12:14:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041404#M754873</guid>
      <dc:creator>Aussan</dc:creator>
      <dc:date>2007-04-19T12:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041405#M754874</link>
      <description>here is the example &lt;BR /&gt;&lt;BR /&gt;UPDATE table1&lt;BR /&gt;SET table1.cola="PEPSI"&lt;BR /&gt;WHERE tabel2.feature = "PEPSI TYPE" AND table1.master_key=table1.master_key</description>
      <pubDate>Thu, 19 Apr 2007 12:17:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041405#M754874</guid>
      <dc:creator>Aussan</dc:creator>
      <dc:date>2007-04-19T12:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041406#M754875</link>
      <description>here is the example &lt;BR /&gt;&lt;BR /&gt;UPDATE table1&lt;BR /&gt;SET table1.cola="PEPSI"&lt;BR /&gt;WHERE tabel2.feature="PEPSI TYPE" AND table1.master_key=table1.master_key</description>
      <pubDate>Thu, 19 Apr 2007 12:18:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041406#M754875</guid>
      <dc:creator>Aussan</dc:creator>
      <dc:date>2007-04-19T12:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041407#M754876</link>
      <description>what happend?</description>
      <pubDate>Thu, 19 Apr 2007 12:26:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041407#M754876</guid>
      <dc:creator>Aussan</dc:creator>
      <dc:date>2007-04-19T12:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041408#M754877</link>
      <description>What error do you get?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 19 Apr 2007 12:29:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041408#M754877</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2007-04-19T12:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041409#M754878</link>
      <description>same error&lt;BR /&gt;I have never used double quotes around values</description>
      <pubDate>Thu, 19 Apr 2007 12:29:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041409#M754878</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2007-04-19T12:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041410#M754879</link>
      <description>invalid sql statement</description>
      <pubDate>Thu, 19 Apr 2007 12:31:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041410#M754879</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2007-04-19T12:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041411#M754880</link>
      <description>what's the error??</description>
      <pubDate>Thu, 19 Apr 2007 12:32:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041411#M754880</guid>
      <dc:creator>Aussan</dc:creator>
      <dc:date>2007-04-19T12:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041412#M754881</link>
      <description>could you cut and past the exact syntax you are using, and also the error does it point at the exact line the error is or no</description>
      <pubDate>Thu, 19 Apr 2007 12:36:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041412#M754881</guid>
      <dc:creator>Aussan</dc:creator>
      <dc:date>2007-04-19T12:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041413#M754882</link>
      <description>ORA-00900&lt;BR /&gt;ORA-00904 invalid column name.&lt;BR /&gt;But, the columns are correct!&lt;BR /&gt;It is complaining on the master_key columns</description>
      <pubDate>Thu, 19 Apr 2007 12:36:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041413#M754882</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2007-04-19T12:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041414#M754883</link>
      <description>What error do you get?&lt;BR /&gt;&lt;BR /&gt;This should do it for you&lt;BR /&gt;&lt;BR /&gt;update tab1e1&lt;BR /&gt;set table1.cola = 'PEPSI'&lt;BR /&gt;where  exists&lt;BR /&gt;( select 'x' from&lt;BR /&gt;     table2 where table1.masterkey = &lt;BR /&gt;     table2.masterkey&lt;BR /&gt;     and table2.feature='PEPSI TYPE')&lt;BR /&gt;</description>
      <pubDate>Thu, 19 Apr 2007 12:39:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041414#M754883</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2007-04-19T12:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041415#M754884</link>
      <description>that's:&lt;BR /&gt;"update table1"&lt;BR /&gt;not &lt;BR /&gt;"update tab1e1" at the statement beginning of course...&lt;BR /&gt;&lt;BR /&gt;(oops)</description>
      <pubDate>Thu, 19 Apr 2007 12:42:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041415#M754884</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2007-04-19T12:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041416#M754885</link>
      <description>Hi Laura, &lt;BR /&gt;&lt;BR /&gt;For this question and many others like it, may I recommend "The SQL Cookbook" by Anthony Molinaro or any similar book:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.oreilly.com/catalog/sqlckbk/" target="_blank"&gt;http://www.oreilly.com/catalog/sqlckbk/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The question you ask is described there on page 71 "Updating when Corresponding Rows Exist"&lt;BR /&gt;&lt;BR /&gt;Alternative to the 'exists' clause it to use an 'in' clause.&lt;BR /&gt;Untested...&lt;BR /&gt;&lt;BR /&gt;update table1 &lt;BR /&gt;set cola = 'PEPSI' &lt;BR /&gt;where masterkey in &lt;BR /&gt;( select masterkey &lt;BR /&gt;from table2 &lt;BR /&gt;where feature = 'PEPSI TYPE');&lt;BR /&gt;&lt;BR /&gt;Hope this helps some,&lt;BR /&gt;Hein van den Heuvel (at gmail dot com)&lt;BR /&gt;HvdH Performance Consulting&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 19 Apr 2007 13:14:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041416#M754885</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-04-19T13:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041417#M754886</link>
      <description>FWIW,&lt;BR /&gt;&lt;BR /&gt;For the sake of correctness  - Hein's posting is much more common, and is a better answer to your problem.&lt;BR /&gt;&lt;BR /&gt;The reason that I gave my answer is that this is something I may try to use to when attempting to tune a piece of someone else's code and get more performance out of a query that is being troublesome due to some issue I would be seeking to change in the execution plan.  Keeping in mind that method is used more for isolating subqueries in a purposeful manner (and not development in general), you should use primarily use Hein's approach, it's more standard.  My suggested method would normally add unnecessary verbage and an extra step to an otherwise normally fine  execution plan.</description>
      <pubDate>Thu, 19 Apr 2007 14:00:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041417#M754886</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2007-04-19T14:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041418#M754887</link>
      <description>&lt;!--!*#--&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I agree with John that Hein's solution is more appropriate.&lt;BR /&gt;&lt;BR /&gt;yd@MYDB.MU&amp;gt; create table table1 (master_key number(1), cola varchar2(10));&lt;BR /&gt;&lt;BR /&gt;Table created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:02.29&lt;BR /&gt;yd@MYDB.MU&amp;gt; create table table2 (master_key number(1), feature varchar2(10));&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Table created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.45&lt;BR /&gt;yd@MYDB.MU&amp;gt; insert into table2 values (1,'PEPSI TYPE');&lt;BR /&gt;&lt;BR /&gt;1 row created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.03&lt;BR /&gt;yd@MYDB.MU&amp;gt; insert into table1 values (1,'');&lt;BR /&gt;&lt;BR /&gt;1 row created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.02&lt;BR /&gt;yd@MYDB.MU&amp;gt; insert into table1 values (2,'');&lt;BR /&gt;&lt;BR /&gt;1 row created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.06&lt;BR /&gt;yd@MYDB.MU&amp;gt; insert into table1 values (1,'');&lt;BR /&gt;&lt;BR /&gt;1 row created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.01&lt;BR /&gt;yd@MYDB.MU&amp;gt; update table1&lt;BR /&gt;  2  set cola='PEPSI'&lt;BR /&gt;  3  where master_key in (select master_key from table2&lt;BR /&gt;  4  where feature='PEPSI TYPE');&lt;BR /&gt;&lt;BR /&gt;2 rows updated.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.09&lt;BR /&gt;yd@MYDB.MU&amp;gt; select * from table1;&lt;BR /&gt;&lt;BR /&gt;         1 PEPSI&lt;BR /&gt;         2&lt;BR /&gt;         1 PEPSI&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.04&lt;BR /&gt;yd@MYDB.MU&amp;gt; &lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Apr 2007 05:39:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041418#M754887</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2007-04-20T05:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: update table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041419#M754888</link>
      <description>I agree with Hein also.&lt;BR /&gt;I tried the where exists clause and completely hung my session.&lt;BR /&gt;Where the " Where in" clause took no time to return!&lt;BR /&gt;&lt;BR /&gt;Saved it as a gem!&lt;BR /&gt;Thanks all</description>
      <pubDate>Fri, 20 Apr 2007 08:52:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-table/m-p/5041419#M754888</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2007-04-20T08:52:25Z</dc:date>
    </item>
  </channel>
</rss>

