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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: HELP WITH UPDATE

RE: HELP WITH UPDATE

From: Weerd de E.C. Kirsten <Kirsten.deWeerd_at_Oranjewoud.nl>
Date: Wed, 26 Jul 2000 08:57:07 +0100
Message-Id: <10570.112975@fatcity.com>


Hi,

Couldn't the replace-statement give the wrong result if not carefully used (But of course, DBA's are always carefull!)

Example : if there would exist an empno like '1001', wouldn't that become '1991' with this particular replace ?

Just sharing thought ...

Greets,

Kirsten

> -----Original Message-----
> From: Suhen Pather [SMTP:pathers5_at_telkom.co.za]
> Sent: Tuesday, July 25, 2000 4:27 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Re: HELP WITH UPDATE
>
> Thanks man
>
> This statement update emp set empno=replace(empno,'00','99') works fine
>
> I never new there was a replace commant.
>
> What I used was update emp set empno='99' || substr(empno,2,2) where empno
> like '00%';
>
> It also works but I like your method of replace.
>
>
> Thanks
> Suhen
>
> >>> smoriano_at_sicon.net 07/25/00 01:58PM >>>
> Hi
>
> if empno is char Try with
>
> update emp set empno=replace(empno,'00','99')
>
> if empno is number (this one i'm no tsure it works fine)
>
> update emp set empno=to_number( replace(to_char(empno),'00','99') )
>
> Suhen Pather wrote:
>
> > Hi
> >
> > I have a table called EMP
> >
> > EMPNO NAME JOB
> > 001 Scott DBA
> > 002 Tiger DEV
> > 003 King MAN
> > ......
> > 0010 Arthur PROG
> >
> > If I need to update the column EMPNO and change all the values in the
> beginning from 00 to 99.
> > So the table will look like
> >
> > EMPNO NAME JOB
> > 991 Scott DBA
> > 992 Tiger DEV
> > 993 King MAN
> > ......
> > 9910 Arthur PROG
> >
> > How can I update the table EMP's column EMPNO and change all the values
> from 00 to 99 in one go without doing each update manually.
> >
> > TIA
> > $uhen
> >
> > --
> > Author: Suhen Pather
> > INET: pathers5_at_telkom.co.za
> >
> > Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> > San Diego, California -- Public Internet access / Mailing Lists
> > --------------------------------------------------------------------
> > To REMOVE yourself from this mailing list, send an E-Mail message
> > to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> > the message BODY, include a line containing: UNSUB ORACLE-L
> > (or the name of mailing list you want to be removed from). You may
> > also send the HELP command for other information (like subscribing).
>
> --
> Author: sergio
> INET: smoriano_at_sicon.net
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>
> --
> Author: Suhen Pather
> INET: pathers5_at_telkom.co.za
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
Received on Wed Jul 26 2000 - 02:57:07 CDT

Original text of this message

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