Oracle——函数

时间:2014-04-29 18:08:00   收藏:0   阅读:497

CREATE FUNCTION annual_income(spNAme VARCHAR2) RETURN
NUMBER IS yearSal number(7,2);
BEGIN
  SELECT (sal+NVL(comm,0))*12 INTO yearSal FROM emp WHERE ename=spNAme;
  RETURN yearSal;
END;
/

SQL> var income number;
SQL> call annual_income(‘SMITH‘) into:income;

 

SELECT annual_income(ename) from emp;

Oracle——函数,码迷,mamicode.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!