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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Query Help

Re: Query Help

From: Matthias Rogel <rogelREMOVE_at_THISweb.de>
Date: Fri, 24 Jan 2003 16:40:09 +0100
Message-ID: <b0rmoq$sletk$1@ID-86071.news.dfncis.de>


4DAirlines wrote:
> This is probably basic, but I can't figure it out...
> I need to run this query, and I have to keep commenting out each line,
> and then run it, then comment out the line and run the next one. Is
> there a way to write this query so that I can just run it once, and it
> will update the column all in one go, using 'AND', or something? This
> is my first post, please be gentle...!
>
>
> update table1
> set fbc = 'j' where fbc = 'c'
> --set abc = 'jw' where abc = 'cw'
> --set abc = 'jx' where abc = 'cx'
> --set abc = 'y' where abc = 'y'
> --set abc = 'yce' where abc = 'yce'
> --set abc = 'bce' where abc = 'bce'
> etc.

assuming that fbc = abc:

update table1
set abc = decode(abc,

                  'c', 'j',
                  'cw', 'jw',
                  'cx', 'jx',
                  ....,
                  abc)

or (if U want to avoid trivial updates)

update table1
set abc = decode(abc,

                  'c', 'j',
                  'cw', 'jw',
                  'cx', 'jx',
                  ....)

where abc in ('c', 'cw', 'cx', ...)

Matthias Received on Fri Jan 24 2003 - 09:40:09 CST

Original text of this message

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