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;
评论(0)