警告:创建的包主体存在编译错误...在 plsql 中

Warning: Package Body created with compilation errors...in plsql

错误:

警告:创建的包主体存在编译错误。 开始 * 第 1 行的错误: ORA-04063: 包体“P12284.EMP_DESIGNATION”有错误 ORA-06508: PL/SQL: 找不到正在调用的程序单元: “P12284.EMP_DESIGNATION” ORA-06512: 在第 2 行

如何解决这个问题?请帮助我,我是 PL/SQL

的新手

`

set serveroutput on;
    CREATE OR REPLACE PACKAGE EMP_DESIGNATION 
    AS
    PROCEDURE EMP_DETAILS(PS_design employee.designation%TYPE, PS_incentive number);
    END EMP_DESIGNATION;
    /
    CREATE OR REPLACE PACKAGE BODY EMP_DESIGNATION
    AS
    PROCEDURE EMP_DETAILS(design employee.designation%TYPE, incentive number)
    IS
    BEGIN
        update employee set employee.salary = employee.salary + incentive where designation = design ;
        DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ' employee(s) are updated');
         
    END;
    /
    `

你也需要结束你的包体-

CREATE OR REPLACE PACKAGE BODY EMP_DESIGNATION
AS
    PROCEDURE EMP_DETAILS(design employee.designation%TYPE, incentive number)
    IS
    BEGIN
        update employee set employee.salary = employee.salary + incentive where designation = design ;
        DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ' employee(s) are updated');
         
    END;
END EMP_DESIGNATION;
/

你有两个问题,

  1. emp_details 的签名在规范和正文中都应该匹配

  2. 您忘记了end包体中的程序。

    CREATE OR REPLACE PACKAGE emp_designation AS
    PROCEDURE emp_details
      (
        ps_design    employee.designation%TYPE
      , ps_incentive NUMBER
      );
    END emp_designation;
    /
    
    CREATE OR REPLACE PACKAGE BODY emp_designation AS
      PROCEDURE emp_details
        ( 
          ps_design employee.designation%TYPE
        , ps_incentive NUMBER
        ) 
      IS
      BEGIN
        UPDATE employee SET employee.salary = employee.salary + ps_incentive 
          WHERE designation = ps_design; 
        dbms_output.put_line(SQL%ROWCOUNT || ' employee(s) are updated');
      END emp_details;
    END;
    /