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: How to update the record based on certain criterias.

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

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Mon, 08 Jul 2002 16:00:25 GMT
Message-ID: <3D29B6EC.2CA000D1@exesolutions.com>


kpn wrote:

> Hi all,
>
> I'm a newby to Oracle and I'm not good at SQL programming. I've a problem
> that I need to update some product code in a big table based on products'
> category.
>
> Table's schema:
> prodcode varchar2(20),
> category varchar2(20),
> unit price number,
> stock number.
>
> 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.

You use an WHERE clause on the update statement in the form:

UPDATE table_name
SET field_name = some_thing
WHERE field_name = some_value;

To append a prefix look up CONCATENATION in your book.

Daniel Morgan Received on Mon Jul 08 2002 - 11:00:25 CDT

Original text of this message

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