Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Simple Update Question
Hi,
I know my sql stinks and I don't want to write a pl/sql block for a
simple update. I need two update statements. I will run them one after
another. The problem is I don't want the update statements to put a
null value in the column if there is no corresponding value. Here's the
update
update tmp_combined_rpt_defn tcrd
set hier_nbr = (
select distinct cy.class_id from class_yr cy where cy.class_nbr = tcrd.class_nbr )The problem is there are occasions when there is no matching class_id for some rows. In that case, I donot want the hier_nbr to be updated. I tried something like
select distinct nvl(cy.class_id, hier_nbr) and it didnot work. Any presents for the christmas.
--
Ender Wiggin
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Thu Dec 30 1999 - 09:26:30 CST