0

Error:

Warning: Package Body created with compilation errors. BEGIN * ERROR at line 1: ORA-04063: package body "P12284.EMP_DESIGNATION" has errors ORA-06508: PL/SQL: could not find program unit being called: "P12284.EMP_DESIGNATION" ORA-06512: at line 2

How to solve This ? Please Help me I'm New to 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;
    /
    `
  • Hello Ankit, debugging pl/sql packages on the command line is a challenge. I suggest you use a tool like SQL Developer (which is free) and makes your life a lot easier when it comes to locating the issue. – Koen Lostrie Aug 21 '20 at 12:45

2 Answers2

2

You have two problems,

  1. The signature of the emp_details should match in both spec and body

  2. You forgot to end the procedure in package body.

    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;
    /
    
Sujitmohanty30
  • 3,256
  • 2
  • 5
  • 23
1

You need to end your package body too -

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;
/
Ankit Bajpai
  • 13,128
  • 4
  • 25
  • 40