存储函数

来源:互联网 发布:去码软件 编辑:程序博客网 时间:2024/06/05 07:37

/*
查询某个员工的年收入

CREATE [OR REPLACE] FUNCTION 函数名(参数列表)
RETURN 函数值类型
AS
PLSQL子程序体;

*/
create or replace function queryEmpIncome(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;
/

0 0
原创粉丝点击