Q

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

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

Dig deeper on Oracle error messages

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

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:

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close