PL SQL nested subquery

3526 views plsql

I am trying to get the result into a variable (is it possible to do it as a %rowtype of an existing table? probably not bc of conflicting columns but still it doesn't hurt to ask) where it would display me all the values where the two refs overlap and the i_ref(which is inputted ) also overlaps with the ref from t1.

select *
  into   aRow
  from   table1 t1
where  t1.ref = i_ref
  and  (select * from table2 t2 where t1.ref = t2.ref);

Could you please shed some light into what i am doing wrong with my select?

answered question

1 Answer


You can join tables instead of nested subquery:

select t1.*
into aRow
from table1 t1 join table2 t2 on t1.ref = t2.ref
where t1.ref = i_ref

posted this

Have an answer?


Please login first before posting an answer.