Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Help -- NULL value assignment

Re: Help -- NULL value assignment

From: fumi <fumi_at_tpts5.seed.net.tw>
Date: 23 Oct 1999 17:20:18 GMT
Message-ID: <7usqoi$6ft$3@news.seed.net.tw>

Frank Ye <fye_at_laurel.ocs.mq.edu.au> wrote in message news:7up3g9$bmp$1_at_sunb.ocs.mq.edu.au...
> Hi there,
>
> I'd like to have the statement to produce the result
> like
>
> update p_item a
> set a.unit = NVL((select b.unit
> from histpay b
> where b.employee# = a.employee#
> ),a.unit)
>
> I know this is not working, but I want to keep the
> value of "a.unit" if the "select" gets no value. Anyone
> knows how to do it without writing PL/SQL procedure?

Try this:

update (select p.unit as p_unit, h.unit as h_unit

          from p_item p, histpay h
          where p.employee#=h.employee#)
  set p_unit=h_unit; Received on Sat Oct 23 1999 - 12:20:18 CDT

Original text of this message

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