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: Smart Update, How ?

RE: Smart Update, How ?

From: Jamadagni, Rajendra <Rajendra.Jamadagni_at_espn.com>
Date: Wed, 13 Mar 2002 07:48:37 -0800
Message-ID: <F001.004273BB.20020313074837@fatcity.com>


I don't understand ....

you said ... "In my cursor loop, I have an update statement, see below. Now I need to the update only for the field (in that cursor) that has data in it. (which means when is null, that field will not be updated). "

  1. do you want to update the columns in the table, if the columns are not null? or
  2. do you want to update the columns in the table id the RECORD attributes are not null?

To achieve problem as state in (1) you need to use dynamic SQL because you don't know which columns you will be updating.

For (2)
update my_table

   set col_1 = nvl(myrec.col_1, col_1) .....

Here you will check the value in the record (rec_UpdIES) attribute, if it is null, you assign the value of the column to itself, otherwise you update it with record attribute.

Am I making it clear??

Raj



Rajendra Jamadagni MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

QOTD: Any clod can have facts, but having an opinion is an art!


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jamadagni, Rajendra
  INET: Rajendra.Jamadagni_at_espn.com

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).

Received on Wed Mar 13 2002 - 09:48:37 CST

Original text of this message

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