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

Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL Question: How to do an UPDATE to partially change a value?

Re: SQL Question: How to do an UPDATE to partially change a value?

From: <gmei_at_my-deja.com>
Date: 2000/02/16
Message-ID: <88eomu$jfi$1@nnrp1.deja.com>#1/1

In article <88ekph$giq$1_at_nnrp1.deja.com>,   robert.bowen_at_mubimedia.com wrote:
> Hello all. I have a question - I have a date column with screwed up
> data. Instead of '1999' in some rows I have '2099'. My own latent Y2K
> bug. Anyway ... what's the easiest way to change these rows, just to
> get rid of the '20' and replace it with '19' ?
>
> I tried doing it using wildcards and old.date_col but I can't get it
 to
> work ...
>
> Anyone got a quick fix? I need a hit!
>
> Thanks.
> syg
>

OK, the difference is 100 years (or 120 months)

select * from your_table
where TO_CHAR(your_column, 'YYYY') like '20%';

update your_table
set your_column = add_months(your_column, -1200) where TO_CHAR(your_column, 'YYYY') like '20%';

then

commit

Hope this helps.

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Feb 16 2000 - 00:00:00 CST

Original text of this message

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