title: Decode with alias name in cursor
body: <p>I want to use decode function in cursor with alias names to avoid column ambiguity so i used below approach.</p>
  
  <p>I have code such as:</p>
  
  <pre><code> declare
       cl number;
       cursor c is 
          select c1.rowid,c1.col1,
                 DECODE(c1.col2, 'XYZ', c1.col3, 10) cl 
            from table1 d,table2 c1 where c1.process_id=13525 and d.col3(+)=cl;
  begin
    for rec in c
    loop
      dbms_output.put_line(NVL(rec.cl,'-1'));
    end loop;
  end;
  </code></pre>
  
  <p>In this, when i will fire query by removing condition 'and d.col3(+)=cl' it will retrieve me data with the value of 'cl' . But when i assign this condtion it will not retrive data and not go in for loop of cursor.I have a matching data in d.col3.</p>
  
  <p>Suppose if i will get cl as 5 then it is also present in d.col3 then it should give me data i did this because i need to remove duplicate records.Because with that single condition i will get duplicate records.Here col3 in d table is as primary key.</p>
  
  <p>So i am not getting why it will not go in for loop as it gets value from query.</p>