Home » SQL & PL/SQL » SQL & PL/SQL » package chk_pack
package chk_pack [message #270627] Thu, 27 September 2007 12:32 Go to next message
manoj9999
Messages: 2
Registered: September 2007
Junior Member
when trying to run the following code it is raising an error
can any body help me whats the errors is

this is my package specification
CREATE OR REPLACE package chk_pack
is
procedure chk_hiredate
(P_hdate in emp.hiredate%type);
procedure chk_dept_mgr
(p_empnr in emp.empno%type,
P_mgr in emp.mgr%type);
end chk_pack;
/
and the package body is
create or replace package body chk_pack
is
procedure chk_hiredate
(p_hdate in emp.hiredate%type)
is
v_lhdate emp.hiredate%type:=add_months(sysdate,-(50*12));
v_hihdate emp.hiredate%type:=add_months(sysdate,3);
begin
if (P_hdate) not between v_lhdate and v_hihdate or P_hdate is null then
raise_application_error(-20344,'not a valid date');
end if;
end chk_hiredate;
procedure chk_dept_mgr
(p_empnr in emp.empno%type,
P_mgr in emp.mgr%type)
is
v_deptno emp.deptno%type;
v_empno emp.empno%type;
begin
select deptno
into v_deptno
from emp
where empno=p_empnr;
exception
when no_data_found then
raise_application_error(-20346,'not a valid empno');
end;
begin
select empno
into v_empno
from emp
where empno=p_mgr
and job='MAN%'
and deptno=v_deptno;
exception
when no_data_found then
raise_application_error(-20346,'not a valid manager for this department');
end;
end chk_dept_mgr;
end chk_pack;

and the error iam getting is

PLS-00103: Encountered the symbol "END"

at line 39:1
Re: package chk_pack [message #270629 is a reply to message #270627] Thu, 27 September 2007 12:37 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Please always post your Oracle version (4 decimals).

Regards
Michel
Re: package chk_pack [message #270698 is a reply to message #270627] Thu, 27 September 2007 15:38 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
The second procedure isn't correctly written; should be
PROCEDURE chk_dept_mgr
IS
BEGIN
  BEGIN         --> you miss this one!
    SELECT ...
  EXCEPTION
  ...
  END;

  BEGIN
  ...
  END;
END chk_Dept_mgr;
Re: package chk_pack [message #270920 is a reply to message #270627] Fri, 28 September 2007 07:22 Go to previous message
manoj9999
Messages: 2
Registered: September 2007
Junior Member
Hai Littlefoot,

Thanks for the correction my code is working.
Previous Topic: Regarding mutating error on a table
Next Topic: sql select where clause not working
Goto Forum:
  


Current Time: Thu Dec 08 02:30:36 CST 2016

Total time taken to generate the page: 0.12469 seconds