2

我正在努力解决以下问题。我想使用 Oracle VPD 限制对表的访问。在选择策略函数返回的 where 子句中,我需要在子查询中引用表,如下所示:

select * from Table t1
where not exists (select 1 from Table t2 where t2.name=t1.name and t2.date=t1.date)

(这个例子除了说明问题没有多大意义)

我无法控制查询的选择部分。

select * from Table t1

可以为该表指定任何别名或根本不指定别名。因此,我不知道如何在 where 子句中引用该表。有没有办法解决这个问题?

(甲骨文 10GR2)

4

1 回答 1

0

我认为您将需要使用 NOT IN:

(name, datecol) not in (select name, datecol from table2)
于 2010-10-19T12:42:07.887 回答