/*
利用存儲函數,查詢某個員工的年薪
sal*12+ nvl(comm)
*/
create or replace function queryemp(eno in number)
return number
as
psal emp.sal% type;
pcomm emp.comm% type;
begin
select sal,comm into psal,pcomm from emp where empno=eno;
--計算傳回
return psal*12 + nvl(pcomm,0);
end;
/