Home » Developer & Programmer » Forms » Package error! thanks!
Package error! thanks! [message #246803] Fri, 22 June 2007 01:11 Go to next message
mell.gu
Messages: 6
Registered: June 2007
Location: China
Junior Member

something wrong with second Procedure package below.help me friends!
first package:
Package employee is
procedure add_emp(ename varchar2,job varchar2,sal number);
procedure del_emp(empid number);
end;
second package:
PACKAGE BODY employee IS
procedure add_emp(ename varchar2,job varchar2,sal number);
new_empno number;
begin
select emp_no_seq.nextval into new_empno from dual;
insert into emp(empno,ename,job,sal,hiredate)
values(new_empno,ename,job,sal,sysdate);

procedure del_emp(empid number);
begin
delete from emp where empno=empid;
end del_emp;
end employee;

Re: Package error! thanks! [message #246995 is a reply to message #246803] Fri, 22 June 2007 14:57 Go to previous message
lavallee_g
Messages: 22
Registered: May 2005
Location: Quebec
Junior Member
Hi,
Your declaration and procedure signature are a little wrong...

Look at the following exemple, it migth help you a little bit:

Package employee is 
  procedure add_emp(P_ename IN varchar2
                   ,P_job   IN varchar2
                   ,P_sal   IN number
                   );
  procedure del_emp(P_empid IN number);
end;


PACKAGE BODY employee IS

  procedure add_emp(P_ename IN varchar2
                   ,P_job   IN varchar2
                   ,P_sal   IN number
                   )
  IS 
    new_empno number;
  BEGIN

    select emp_no_seq.nextval into new_empno from dual;

    insert into emp(empno,ename,job,sal,hiredate)
    values(new_empno,P_ename,P_job,P_sal,sysdate);
  when no_data_found then  -- or when others...
    -- message or just null;
  END;

  procedure del_emp(P_empid IN number)
  is
  begin
    delete from emp where empno=P_empid;
  end del_emp;

end employee;


Hope I helped... Good luck

[Updated on: Fri, 22 June 2007 14:59]

Report message to a moderator

Previous Topic: Form Error
Next Topic: Need help in using Radio Buttons, Check Boxes at run Time
Goto Forum:
  


Current Time: Sun Dec 04 04:48:59 CST 2016

Total time taken to generate the page: 0.08560 seconds