Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: how to write this sql?
I don't understand the tendency to write everything inline.
create or replace function num_upper_lim(x in number, ul in number)
return integer deterministic
as
begin
if (abs(x) >= abs(ul) )
then return(ul);
else return(x);
end if;
end;
/
This function will do precisely what the original poster wants.
select x,num_upper_lim(cnt) from
( select ....group by having...)
What is the fun of creating horrible, unintelligible SQL statements intended to do this little thing?
--
Mladen Gogala
Oracle DBA