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 last published in May 2003

PRO+

Content

Find more PRO+ content and other member only offers, here.

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.

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close