#定义一个比较函数。比较简陋,可以完善下
create or replace function complenum(a in number,b in number)
return number is
result number;
begin
if a > b then
result := a;
else
result:= b;
end if;
return result;
end;
接着调用这个函数:
begin
DBMS_OUTPUT.PUT_LINE(complenum(complenum(1,2),3));
end;
得到最大的数
最傻的方式,强硬比较
select case when a>b and a>c then a
when b>a and b>c then b
else c
end as maxnum
from dual