On Tuesday, February 19, 2013 7:13:42 PM UTC-7, sidd wrote:
>
> u cannot use greatest function with null parameter, it will return null 
> only
>
> On Wed, Feb 20, 2013 at 3:16 AM, Gayathri <gd0...@gmail.com 
> <javascript:>>wrote:
>
>> I just thought about it and found that i can do it with greatest function.
>>
>> v_result := getbasevalue(....) + greatest(getpricediff(....), 0)
>>
>> Thanks,
>> Divya K M
>>
>>
>> On Tue, Feb 19, 2013 at 4:11 PM, Gayathri <gd0...@gmail.com <javascript:>
>> > wrote:
>>
>>> Hi All,
>>>
>>> Need suggestion on how to do this.
>>>
>>> In a PL/SQL block, have an expression like below - 
>>> where 2 functions are called and result is added together.
>>> v_result := getbasevalue(....) + getpricediff(....)
>>>
>>> Function getpricediff(...), if returns value less than 0, then it should 
>>> be substituted as '0' (zero) else whatever value is calculated.
>>>
>>> this is what i am looking for -
>>> v_result := getbasevalue(....) + case if getpricediff(....) < 0 then 0 
>>> else getpricediff(....) end
>>>
>>> any better way to achieve this without calling the function twice?
>>>
>>> Thanks in advance!
>>>
>>
>>  -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Oracle PL/SQL" group.
>> To post to this group, send email to oracle...@googlegroups.com<javascript:>
>> To unsubscribe from this group, send email to
>> oracle-plsql...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/Oracle-PLSQL?hl=en
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Oracle PL/SQL" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to oracle-plsql...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
> It doesn't appear he/she is using greatest() with a function that returns 
a NULL value.  Is there some reason you think that function will return a 
NULL value?  A price difference shouldn't be NULL so the function should 
return a numeric value in all cases.


David Fitzjarrell 

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Oracle PL/SQL" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to oracle-plsql+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to