Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: UPDATE FROM... Oracle vs Microsoft Conversion

Re: UPDATE FROM... Oracle vs Microsoft Conversion

From: Mike Dwyer <bdtmike_at_sbcglobal.net>
Date: Fri, 30 Aug 2002 23:41:23 GMT
Message-ID: <3d70025c.992080326@news.sf.sbcglobal.net>


On Fri, 30 Aug 2002 14:50:42 -0700, "M Hashim" <m.a.n.hashim_at_sympatico.ca> wrote:

>Sometimes it helps to put a legit email address. In the event the problem
>needs a more lengthy solution, it would avoid any back and forth responses
>that may end up cluttering the newsgroup.
>
>Anyways, try this;
>
>update t2 set(col1,col2,col3) =
>
>( select col1,col2,col3 from t3 where col1=3)
>
>where col1=3;
>
>You can play around with the conditions, or none if not needed.
>
>
>
>"Mike Dwyer" <abc_at_iom.com> wrote in message
>news:3d6fb89b.973199687_at_news.sf.sbcglobal.net...
>> I'm converting from Microsoft SQL 2000 to Oracle 9i r2.
>> This is a question about the differences in the UPDATE statement
>> between the two dialects.
>>
>> In Microsoft, i had a table (mytable) with several columns that I
>> periodically updated from corresponding columns from another table
>> (anothertable). I used a form of the UPDATE command as such:
>>
>> UPDATE mytable
>> set field1=u.field1, field2= u.field2......field20=u.field2
>> FROM
>> mytable join anothertable u
>> ON mytable.primarykey= u.primarykey
>>
>> This form apparently doesn't work with Oracle 9i, R2.
>> It appears that I would have to include a separate select statement
>> for each and every one of the columns I want to update. Is this true?
>> or is there another way. Mytable really has about 80 columns to
>> update. That would make one hell of an SQL statement!
>>
>> Thanks.
>> -Mike
>>
>
>

Thanks for the UPDATE solution, hashim.
So noted on the email addy.
-Mike Received on Fri Aug 30 2002 - 18:41:23 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US