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

Home -> Community -> Usenet -> c.d.o.tools -> Re: PL/SQL Help??

Re: PL/SQL Help??

From: <aqs472_at_my-deja.com>
Date: Fri, 17 Nov 2000 21:00:56 GMT
Message-ID: <8v46a4$67r$1@nnrp1.deja.com>

In article <8v45qq$5nt$1_at_nnrp1.deja.com>,   schmidm_at_kta95.com wrote:
> I think this should work:
> update empl set(cont_name_1, cont_phone_1, cont_rel_1) =
> (select contact, phone, relation from kta_emerg
> where num='1' and userid=empl.email_id);
> update empl set(cont_name_2, cont_phone_2, cont_rel_2) =
> (select contact, phone, relation from kta_emerg
> where num='2' and userid=empl.email_id);
>
> but I am getting error:
> ORA-01407: cannot update mandatory (NOT NULL) column to NULL
> even though I have set all null fields in kta_emerg =' '
>
> Thanks
> MS
>
> In article <8v43t8$42d$1_at_nnrp1.deja.com>,
> schmidm_at_kta95.com wrote:
> > I have two tables:
> > empl(...,email_id, cont_name_1, cont_name_2, cont_phone_1,
> > cont_phone_2, cont_rel_1, cont_rel_2,...)
> > kta_emerg(userid, contact, phone, relation,num)
> >
> > I need to update the empl table values from the values in kta_emerg.
> > Specifically, I need:
> > update empl set
> > empl.cont_name_1=kta_emerg.contact,
> > empl.cont_phone_1=kta_emerg.phone,
> > empl.cont_rel_1=kta_emerg.relation
> > where empl.email_id=kta_emerg.userid and kta_emerg.num='1';
> > update empl set
> > empl.cont_name_2=kta_emerg.contact,
> > empl.cont_phone_2=kta_emerg.phone,
> > empl.cont_rel_2=kta_emerg.relation
> > where empl.email_id=kta_emerg.userid and kta_emerg.num='2';
> >
> > I know this isn't the proper syntax, but hopefully someone has a
 simple
> > solution!
> >
> > Thanks
> > MS
> >
> > --
> > Martin Schmid
> > Applications Developer
> > KtaNet
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> --
> Martin Schmid
> Applications Developer
> KtaNet
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Use Oracle function NVL so you can control NULL fields and give them a value. Usage is NVL(field_name, value_if_null). So what you could do is set column = NVL(source_column, whatever_value_if_null) ...

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Nov 17 2000 - 15:00:56 CST

Original text of this message

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