PL SQL 嵌套子查询

PL SQL nested subquery

我正在尝试将结果放入一个变量中(是否可以将其作为现有 table 的 %rowtype?可能不是因为列冲突),它会向我显示所有两个 refs 重叠的值和 i_ref(输入的)也与来自 t1 的 ref 重叠。

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

我的 select 做错了什么?

您可以连接表而不是嵌套子查询:

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