Home » SQL & PL/SQL » SQL & PL/SQL » PLS-00201 identifier must be declared
PLS-00201 identifier must be declared [message #251790] Mon, 16 July 2007 12:08 Go to next message
jordan_dba
Messages: 19
Registered: May 2007
Location: SF, CA
Junior Member
Need help with a stored proc I am writing. The problem is I have to do a self join with a particular table twice and hence call it during the rest of the procedure... I get the error PLS-00201 when I try to compile it.. any help will be appreciated with how to solve this...
--------------------
  • Attachment: test_sku.txt
    (Size: 1.66KB, Downloaded 199 times)
Re: PLS-00201 identifier must be declared [message #251795 is a reply to message #251790] Mon, 16 July 2007 12:27 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You can't do that!
IF     v_count > 0
   AND v_site_avail = 1
   AND b.price_list = v_b_plist
   AND c.price_list = v_d_plist
If you need a table column in an IF-THEN-ELSE, select it into a variable and use that variable in there, NOT a column!
Re: PLS-00201 identifier must be declared [message #251801 is a reply to message #251795] Mon, 16 July 2007 12:44 Go to previous messageGo to next message
jordan_dba
Messages: 19
Registered: May 2007
Location: SF, CA
Junior Member
Thanks.. I thought about doing it that way but problem is I have to do a self join on that table. That is where the confusion is. How do I get that done using a variable?
Re: PLS-00201 identifier must be declared [message #251802 is a reply to message #251801] Mon, 16 July 2007 12:55 Go to previous message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
DECLARE
  l_variable table.column%TYPE;
BEGIN
  SELECT a.column_value
  INTO l_variable
  FROM table a
  WHERE some_condition;

  IF l_variable = some_value
  THEN 
     ...
  END IF;
END;
Previous Topic: Need a query
Next Topic: Loops ....
Goto Forum:
  


Current Time: Fri Dec 09 05:50:49 CST 2016

Total time taken to generate the page: 0.09019 seconds