Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My Oracle view uses a table that doesn't exist, but I can still query it

Tags:

sql

oracle

view

I have an Oracle view that uses a table that I cannot find anywhere. However, I can still query the view, which I would have thought would be impossible.

Are the view contents cached somewhere, from when the table still existed, or am I simply not looking hard enough for the table?

Just to be clear: I've looked in ALL_TABLES and ALL_OBJECTS and the table (or whatever it is) doesn't appear in either.

like image 845
TomSW Avatar asked Dec 17 '22 20:12

TomSW


1 Answers

This is very possible.. Granting select on a view does not grant select on the underlying tables. This allows me to create a view that exposes a couple columns from a table that I don't want you to see all of. You have to have access on the table for it to show up in the ALL_TABLES view. If it really is a table, you should be able to find it in the DBA_TABLES view (assuming you have access to the DBA_TABLES view), which has everything and not just tables that your user has privileges on.

In fact, the ALL_TABLES view is a perfect example of this situtation. I bet you can't find the tables used in that view either, as you probably don't have permissions on the SYS tables that it is based on (e.g. SYS.user$, SYS.obj$, etc).

like image 135
Craig Avatar answered Dec 28 '22 06:12

Craig