问题
I have the query below:
select * from public_dependency pd
where REFERENCED_OBJECT_ID = 305318
The strange thing is that this returns 26 rows. When I join in the referenced objects, I get three null rows, but a count of 26. And if I use 'join' I get back 23 rows. So there are objects seemingly not in all_objects but in public_dependency.
select * from public_dependency pd
left join all_objects o on o.OBJECT_ID = pd.OBJECT_ID
where REFERENCED_OBJECT_ID = 305318
How is it possible that there are objects in public_dependency that are not in all_objects?
回答1:
all_objects only shows you objects you have permissions on, not all objects in the database. You'd need to query dba_objects to see everything, if you have permissions to do that.
public_dependency appears to include object IDs for objects you don't have permissions on. The objecct IDs on their own don't tell you much, so it isn't revealing anything about objects you can't see (other than that there are some objects you can't see).
So it isn't odd that there is an apparent discrepancy between what the two views reference. Querying all_dependencies might give you a more comsistent picture.
来源:https://stackoverflow.com/questions/24541307/how-can-public-dependency-contain-references-to-objects-not-in-all-objects