//函數案例
--輸入僱員的姓名,返回該僱員的年薪
create function sp_fun(spName varchar2)
return number is yearSal number(7,2);
begin
--執行部分
select sal*12+nvl(comm,0)*12 into yearSal from emp where ename=spname;
return yearSal;
end;
--函數調用
var income number
call sp_fun('SCOTT') into:income
print income;
注:同意我們在java程序中調用該函數
select sp_fun('scott') from dual;
通過rs.getInt(1)得到返回的結構