Link to home
Start Free TrialLog in
Avatar of JGreenwood
JGreenwood

asked on

Decode in Oracle 8i

I need to insert a value in a column based on the value of two other columns...  For example, if column A and column B are NOT NULL then update column C with the value of column A.  Can this be done using DECODE?

thanks,
JGreenwood.  
ASKER CERTIFIED SOLUTION
Avatar of andrewst
andrewst

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JGreenwood
JGreenwood

ASKER

thanks, that worked... JGreenwood.
I don't believe an AND operation can be done using DECODE.

Are you trying to avoid PL/SQL? Can you just use the following:

UPDATE <tablename>
SET c = a
WHERE a IS NOT NULL
  AND b IS NOT NULL
;
Yes, I am trying to avoid PL/SQL...  I want to do this in SQL+...  What is the best way?
The best way is the update statement I gave you earlier, unless andrewst's suggestion works for you which is actually the best answer to your original question.