Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: calc field
You can't multiply NULL times a value. That just doesn't make sense.
However, you can test for NULL with the DECODE function and have it
display one value if NULL and another if not NULL. For instance:
SELECT DECODE(productPrice,NULL,WarehousePrice*1.5,productPrice*1.5) as "NewPrice" FROM......
HTH,
Brian
Roger Smith wrote:
>
> 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
-- =================================================================== Brian Peasland dba_at_remove_spam.peasland.com Remove the "remove_spam." from the email address to email me. "I can give it to you cheap, quick, and good. Now pick two out of the three"Received on Tue Sep 30 2003 - 15:07:56 CDT