开发者

Why do queries against this synonym return no records when queries against its referenced table do?

I have a table named AP.AP_BATCHES_ALL:

SELECT
  OWNER,
  OBJECT_NAME,
  OBJECT_TYPE
FROM
  ALL_OBJECTS
WHERE
  OWNER = 'AP' AND OBJECT_NAME = 'AP_BATCHES_ALL'
+-------+----------------+-------------+
| OWNER | OBJECT_NAME    | OBJECT_TYPE |
+-------+----------------+-------------+
| AP    | AP_BATCHES_ALL | TABLE       |
+-------+----------------+-------------+

I can query this table:

SELECT * FROM AP.AP_BATCHES_ALL

200,000+ records are returned.

开发者_JS百科

Now, there is a synonym named APPS.AP_BATCHES that references the aforementioned AP.AP_BATCHES_ALL table:

SELECT * FROM ALL_SYNONYMS WHERE OWNER = 'APPS' AND SYNONYM_NAME = 'AP_BATCHES'
+-------+--------------+-------------+----------------+---------+
| OWNER | SYNONYM_NAME | TABLE_OWNER | TABLE_NAME     | DB_LINK |
+-------+--------------+-------------+----------------+---------+
| APPS  | AP_BATCHES   | AP          | AP_BATCHES_ALL |         |
+-------+--------------+-------------+----------------+---------+

Now, when I query APPS.AP_BATCHES (the synonym), I get no records:

SELECT * FROM APPS.AP_BATCHES

No records are returned, even though APPS.AP_BATCHES is merely a synonym for AP.AP_BATCHES_ALL (the table containing 200,000+ records).

Why aren't queries against the synonym returning records when queries against the referenced table do?


At first I thought that you were running into a shadowing issue between a view and a public synonym. This is not the case here however, since APPS can only own one object named AP_BATCHES (the synonym).

Would there be, by any chance, row-level policies (v$vpd_policies) defined on this synonym?

By the way, I didn't know that (1) you could add policies to synonyms and (2) that the release 12 was using them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜