Re: How to update the record based on certain criterias.

From: Lothar Armbruester <lothar.armbruester_at_t-online.de>
Date: Mon, 8 Jul 2002 18:11:59 +0200
Message-ID: <PM0003A545EF85559D_at_hades.none.local>


kpn wrote:
> Hi all,
>

 [...]
>
> For example, I've four categories of products, TV, DV, DC, VHC. Each
> category has more than 400 records. Due to some reasons, we want to
> add each
> product code with a prefix. The products belong to TV will append a
> "T" at
> front of each record, and the products belong to DV will add a "D" at
> front
> of each record .
>
> Can someone provide the scripts or procedures for me? Thanks.

Hello kpn,
try this:

update your_table set

   prodcode = decode(category,'TV',prodcode||'T',
                              'DV',prodcode||'D',
                              'DC',prodcode||'C',
                              'VHC',prodcode||'V',
                              prodcode);

..and have a look at the decode function in the manual.

Hope that helps,
Lothar

-- 
Lothar Armbrüster       | la_at_oktagramm.de
Hauptstr. 26            | la_at_heptagramm.de
D-65346 Eltville        | lothar.armbruester_at_t-online.de
Received on Mon Jul 08 2002 - 18:11:59 CEST

Original text of this message