Hello, I was writing a package that contains stored procedures for CRUD, but faced with 00103 error. Tried to search for it but didn't find a solution.
Here is the code:
create or replace Package Employee_Package
As
procedure CreateEmployee( first_name in employee.emp_first_name %type , last_name in employee.emp_last_name %type, SALARY in employee.emp_salary %type, phoneno in employee.emp_phoneno %type, address in employee.emp_address %type, dep_id employee.dep_id%type );
Procedure DeleteEmployee (id number);
PROCEDURE UpdateEmployee ( first_name in employee.emp_first_name %type , last_name in employee.emp_last_name %type, SALARY in employee.emp_salary %type, phoneno in employee.emp_phoneno %type, address in employee.emp_address %type, dep_id employee.dep_id%type);
procedure GetEmployeeById (id number);
End Employee_package;
CREATE or replace PACKAGE body Employee_Package
As
procedure CreateEmployee( first_name in employee.emp_first_name %type , last_name in employee.emp_last_name %type, SALARY in employee.emp_salary %type, phoneno in employee.emp_phoneno %type, address in employee.emp_address %type, dep_id employee.dep_id%type)
As
Begin
insert into employee (emp_first_name ,emp_last_name,emp_salary,emp_phoneno,emp_address , dep_id) values (first_name, last_name, SALARY, phoneno, address , dep_id);
End CreateEmployee;
Procedure DeleteEmployee (id number)
As -- id = 55
Begin
Delete from employee
where emp_id = id ;
End DeleteEmployee;
PROCEDURE UpdateEmployee ( first_name in employee.emp_first_name %type , last_name in employee.emp_last_name %type, SALARY in employee.emp_salary %type, phoneno in employee.emp_phoneno %type, address in employee.emp_address %type, dep_id employee.dep_id%type )
As -- empid = 60 , first_name = 'Bayan' , dep_id = 3
begin
Update Employee
Set emp_first_name = first_name,emp_last_name = last_name,emp_salary = SALARY,emp_phoneno = phoneno, emp_address = address , dep_id = dep_id
where emp_id = emp_id;
End UpdateEmployee;
procedure GetEmployeeById (id number)
As -- id = 25
CURSOR EMP_DATA
IS
Select * from employee;
EMP_VAR EMP_DATA%ROWTYPE;
BEGIN
OPEN EMP_DATA;
LOOP
FETCH EMP_DATA INTO EMP_VAR;
EXIT WHEN (EMP_DATA% NOTFOUND);
DBMS_OUTPUT.PUT_LINE(emp_VAR.emp_id ||' ' || emp_VAR.EMP_first_name||' ' || emp_VAR.EMP_LAST_name||' ' || emp_VAR.EMP_SALARY||' ' || emp_VAR.EMP_PHONENO||' ' || emp_VAR.EMP_ADDRESS||' ' || emp_VAR.DEP_ID );
END LOOP;
CLOSE EMP_DATA;
End GetEmployeeById;
End;