Getting error while Executing Package

后端 未结 3 354
孤独总比滥情好
孤独总比滥情好 2020-12-21 08:27

Table Structure:

Name       Null Type         
---------- ---- ------------ 
DPT_NO          NUMBER       
SALARY          NUMBER(10)   
PERIOD          VARC         


        
3条回答
  •  囚心锁ツ
    2020-12-21 08:33

    You're missing the declaration of the package. The idea is to separate the declaration of the package ("the header", if you will), so other packages/procedures/functions can compile against it from the body (the implementation).

    In your case, you'd need something like:

    CREATE OR REPLACE package salary_sal AS
       PROCEDURE find_sal(c_dpt_no salary.dpt_no%TYPE);
    END salary_sal;
    

    Now, once the package is declared, you can create its body:

    CREATE OR REPLACE package body salary_sal AS
       PROCEDURE find_sal(c_dpt_no salary.dpt_no%TYPE) IS
       c_sal salary.salary%TYPE;
       BEGIN
          SELECT salary INTO c_sal
          FROM salary
          WHERE c_dpt_no= 108;
          dbms_output.put_line('Salary: '|| c_sal);
       END find_sal;
    END salary_sal;
    

提交回复
热议问题