How would one get columns information on table which he doesn't own, but has select granted? This is, without using DESCRIBE table_name
. Consider this example:
如何获得他不拥有的,但已选择授权的表上的列信息?这是,不使用DESCRIBE table_name。考虑这个例子:
// user bob owns table STUDENTS
grant select on students to josh;
// now josh logs in, normally he would do
describe bob.students;
// but he's looking for something along the lines
select column_name from user_tab_columns where table_name = 'STUDENTS';
// which doesn't work, as josh doesn't own any tables on his own
Any ideas? Is this even doable?
有任何想法吗?这甚至可行吗?
3 个解决方案
#1
select column_name from all_tab_columns where table_name = 'STUDENTS';
edit: or, even better
编辑:或者,甚至更好
select owner, column_name from all_tab_columns where table_name = 'STUDENTS';
#3
CONN HR/HR@HSD;
GRANT SELECT ON EMPLOYEES TO SCOTT;
CONN SCOTT/TIGER@HSD;
SELECT owner, column_name FROM all_tab_columns WHERE table_name = 'EMPLOYEES';
#1
select column_name from all_tab_columns where table_name = 'STUDENTS';
edit: or, even better
编辑:或者,甚至更好
select owner, column_name from all_tab_columns where table_name = 'STUDENTS';
#2
Have a look on oracle data dictionary, it should help.
看看oracle数据字典,应该会有所帮助。
#3
CONN HR/HR@HSD;
GRANT SELECT ON EMPLOYEES TO SCOTT;
CONN SCOTT/TIGER@HSD;
SELECT owner, column_name FROM all_tab_columns WHERE table_name = 'EMPLOYEES';