示例:根据员工号,查询员工年收入。
create or replace function queryempincom(eno in numbr)
return number
as
--定义变量保存员工的薪水和奖金
psal emp.sal%type;
pcomm emp.comm%type;
begin
select sal,comm into pasl,pcomm from emp where empno=eno;
return psal*12+nvl(pcomm,0);
end;
create or replace function queryempincom(eno in numbr)
return number
as
--定义变量保存员工的薪水和奖金
psal emp.sal%type;
pcomm emp.comm%type;
begin
select sal,comm into pasl,pcomm from emp where empno=eno;
return psal*12+nvl(pcomm,0);
end;
2017-04-14