What is the way to do this in 1 select statement
if field1 < feild2 then
return(field1)
else
return(field2)
end if;
Printable View
What is the way to do this in 1 select statement
if field1 < feild2 then
return(field1)
else
return(field2)
end if;
Select LEAST(f1,f2)
With Decode its like this
SELECT
DECODE(field1,NULL,'NULL',field1),
DECODE((1-SIGN(1-SIGN(field1 - field2))),1,field1,
NULL, 'Value is null',
field2) result
FROM ur_table
Srini
If you need a more general solution than LEAST, use CASE. It's more intuitive than DECODE and it's ANSI.
Srini - you must be joking, or are you? :rolleyes:
Or how about: LEAST(NVL(f1,f2),NVL(f2,f1))