在第14行创建函数时出错

在第14行创建函数时出错

本文介绍了在第14行创建函数时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CREATE OR REPLACE FUNCTION getsal(id_param NUMBER)
RETURN NUMBER
IS
    sal_increase employees.salary%TYPE;
    tenure NUMBER;
    sal NUMBER;
BEGIN
    SELECT
        salary,
        MONTHS_BETWEEN(SYSDATE, hire_date)/12
    INTO
         sal_increase,
         tenure
    FROM employees
    WHERE employee_id = id_param;
    IF tenure <= 12 THEN
        sal_increase := 0;
    ELSIF tenure BETWEEN 13 AND 36 THEN
        sal_increase := sal_increase+(sal_increase * .05);
    ELSIF tenure BETWEEN 37 AND 60 THEN
        sal_increase := sal_increase+(sal_increase * .1);
    ELSIF tenure BETWEEN 61 AND 120 THEN
        sal_increase := sal_increase+(sal_increase * .15);
    ELSE
        sal_increase := sal_increase+(sal_increase * .2);
    END IF;
        RETURN sal_increase;
END;

DECLARE
    newsalary NUMBER;
BEGIN
    newsalary := getsal(101);
    DBMS_OUTPUT.PUT_LINE('New Salary:'|| newsalary);
END;

推荐答案


这篇关于在第14行创建函数时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 20:12