Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

problem with Sql least function

Ade2May 11 2009 — edited May 11 2009
Hi everyone, I have a request to choose the least of dates in view definition. However, when one of the least argument is null the view picked the null value. examle,

select least(' ', '03/09/2009') test from some_view

Output

Test
Null . I want '03/09/2009' to be outputted when the other argument is null.
Please advice if their is any other function that could be used. When both arguments are not null , then the current output is outputted, however, when one is null, the the output is wrong because the null value is selected.

create or replace view some_view (Enddate)
As
Select least(table1.actual_end_date, table2.actual_end_date)
FROM
(SELECT actual_end_date
FROM some_table
where description = 'TEST') table1,

(SELECT actual_end_date AS end_date
FROM some_table
WHERE description = 'RESULT') table2
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 8 2009
Added on May 11 2009
5 comments
484 views