Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: calc field
IF both are null, can I set a default?
"Michel Cadot" <micadot2removethat_at_free.fr> wrote in message
news:3f79e71d$0$10410$626a54ce_at_news.free.fr...
>
> "Roger Smith" <rsmith22_at_fastmail.net> a écrit dans le message de
> news:4ileb.35770$H86.839814_at_news1.telusplanet.net...
> > Need suggestions on how to accomplish this, I know you can create a
> > calculated field in sql:
> >
> > select (productPrice * 1.5) as "NewPrice"
> >
> > but my calc field is complicated by if then, if productPrice not null
then
> >
> > select (productPrice * 1.5) as "NewPrice" else
> >
> > select (WarehousePrice * 1.5) as "NewPrice"
> >
> > and so on... can this be done in sql?
> >
> > Roger
> >
> >
>
> Use the NVL function:
> select nvl(productPrice,WarehousePrice)*1.5 as "NewPrice" ...
>
> Hope this helps
> Michel Cadot
>
>
Received on Tue Sep 30 2003 - 15:41:37 CDT