Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PLS-00402 error in <FOR IN ( SELECT..)

764712Nov 3 2010 — edited Nov 3 2010
I have a sp with cursor and FOR IN (SELECT) loop, it compilled fine untill I put join into SELECT statement so I'm geting this now:
PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names

I triple checked that my SELECT is working fine from Query window, is there any special rules for < FOR IN ( SELECT)>
it's actually from View if it's matter to colect contra side information for given transaction
FOR i IN  (  
    select t1.IDCUST, t1.AMOUNT, t1.CELL, 
       t1.SHIPCUST, t1.PRODID, 
       t2.SHIPCUST, t2.PRODID, 
      from RYBA.VIEW_TANG t1 
      inner join RYBA.VIEW_TANG t2  on t2.IDCUST = t1.IDCUST
      where  t1.SIDE != t2.side
          )   

   LOOP
....
This error points to the line with <FOR in IN>:
PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names

I see that it doesn't like t1.shipcust and t2.shipcust at the same time, like it doen't recognize my prefixes t1, t2, it's easy fix but why it so?
without t2. columns it compiles OK.

APpreciate you help on this easy for someboy matter.


Tx
Trento
This post has been answered by Hoek on Nov 3 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 1 2010
Added on Nov 3 2010
3 comments
1,366 views