HARINAVEENKUMAR T
HARINAVEENKUMAR T

Reputation: 11

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

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;
    /
    `

Upvotes: 0

Views: 2840

Answers (2)

Sujitmohanty30
Sujitmohanty30

Reputation: 3316

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;
    /
    

Upvotes: 2

Ankit Bajpai
Ankit Bajpai

Reputation: 13527

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;
/

Upvotes: 1

Related Questions