Is the first predicate in effect when I reference the first table after using a predicate to filter it, then in a second predicate on another table?
Using the Oracle VPD facility(aka RLS, aka FGAC), suppose that I use the predicate
(WHERE) id = 'XXXX'
on TableA
and then I use the predicate
(WHERE) col in (SELECT col From TableA)
on TableB
.
Will TableA
be filtered or not? Is filtering is done only outside of predicate 开发者_如何转开发definitions, when you query the tables?
Will I need to make predicate on TableB
like this?:
(WHERE) col in (SELECT col From TableA where id ='XXXX')
Yes, TableA
will be automatically filtered using the predicate you specified (id = 'XXXX')
.
Oracle automatically applies the filters wherever you use (select from
, in this case) the table, even in sub-queries, if the filter criteria is met (see sec_relevant_cols).
精彩评论