Results 1 to 3 of 3

Thread: procedure

  1. #1
    Join Date
    Aug 2006
    Posts
    17

    Question Unanswered: procedure

    CREATE OR REPLACE PROCEDURE add_dept
    1 (v_name IN dept.dname%TYPE DEFAULT 'unknown',
    2 v_loc IN dept.loc%TYPE DEFAULT 'unknown')
    3 IS
    4 BEGIN
    5 INSERT INTO dept
    6 VALUES (dept_deptno.NEXTVAL, v_name, v_loc);
    7 END add_dept;
    8 /
    ORA-02289: sequence does not exist
    This is the error i get when i execute the above procedure.
    can't we use sequence 'NEXTVAL' in aprocedure.

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Have you created a sequence (CREATE SEQUENCE command) named dept_deptno? Oracle means exactly what it says. Nextval is not a function, it is a pseudo column to return the next value from a defined sequence.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  3. #3
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool


    Or, if you created the sequence in another schema you must grant permissions to others to use it.

    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •