Ask the Expert

Error with new_empno variable

I don't understand the error message, can you tell me why it isn't taking the new_empno variable?
SQL> CREATE OR REPLACE PACKAGE BODY ww_hr_pkg
  2  
  3  IS
  4  
  5   PROCEDURE hire(ename VARCHAR2, job VARCHAR2, mgr NUMBER,
  6    hiredate DATE, sal NUMBER, comm NUMBER, deptno NUMBER);
  7   
  8   IS 
  9   
 10   new_empno NUMBER(4);
 11     
 12   BEGIN
 13    SELECT ww_emp_empno_seq.NEXTVAL
 14     INTO new_empno
 15     FROM dual;
 16    INSERT INTO emp
 17     VALUES(new_empno, ename, job, mgr, hiredate, sal, comm, deptno);
 18     
 19   END;
 20   
 21  END ww_hr_pkg;
 22  /

Warning: Package Body created with compilation errors.

SQL> show errors
Errors for PACKAGE BODY WW_HR_PKG:

LINE/COL ERROR
-------- -----------------------------------------------------------------
8/2      PLS-00103: Encountered the symbol "NEW_EMPNO" when expecting one
         of the following:
         begin end function package pragma procedure subtype type use
         <an identifier> <a double-quoted delimited-identifier> cursor
         form current

12/2     PLS-00103: Encountered the symbol "BEGIN" when expecting one of
         the following:
         end function package pragma private procedure subtype type
         use <an identifier> <a double-quoted delimited-identifier>
         cursor form current

21/1     PLS-00103: Encountered the symbol "END" when expecting one of the
         following:
         begin function package pragma procedure form

    Requires Free Membership to View

The problem is that you have a misplaced semi-colon just before the IS in your procedure definition. Change the PROCEDURE declaration as follows to get rid of your problem:

  5   PROCEDURE hire(ename VARCHAR2, job VARCHAR2, mgr NUMBER,
  6    hiredate DATE, sal NUMBER, comm NUMBER, deptno NUMBER)   <--- remove the ; from the end
  7   
  8   IS 
  9   
 10   new_empno NUMBER(4);

For More Information


This was first published in May 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: