This discussion is archived
2 Replies Latest reply: Apr 11, 2009 6:29 AM by 481319 RSS

PLS-00487: Invalid reference to variable '<expression>'

460544 Newbie
Currently Being Moderated
oracle database 10G
OS unix
One of procedure is giving error PLS-00487: Invalid reference to variable '<expression>' while compilation in above database while it is compiling
successfully in other database.
Is there any database error?
  • 1. Re: PLS-00487: Invalid reference to variable '<expression>'
    481319 Guru
    Currently Being Moderated
    DUPLICATE POST!


    Did you check all the objects necessary are existing to compile the procedure, name of the objects references.

    Sanjay
  • 2. Re: PLS-00487: Invalid reference to variable '<expression>'
    Etbin Guru
    Currently Being Moderated
    PLS-00487: Invalid reference to variable "string"
    Cause: A variable was referenced in a way that is inconsistent with its datatype. For example, a scalar variable might have been mistakenly referenced as a record, as follows: DECLARE CURSOR emp_cur IS SELECT empno, ename, sal FROM emp; emp_rec emp_cur%ROWTYPE; my_sal NUMBER(7,2); BEGIN ... total_sal := total_sal + my_sal.sal; -- invalid ...
    Action: Check the spelling of the variable name. Make sure the variable was declared properly and that the declaration and reference are consistent regarding datatype.

    Most probably the compiler "sees" some other type variable with the same name first which in the other database doesn't exist or is out of scope.

    Regards

    Etbin

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points