如何从你不拥有的oracle表中获取列信息(不使用describe)?

时间:2009-01-16 14:59:06

标签: oracle

如何在桌面上获取他不拥有的列信息,但是已选择授予?这是,不使用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

有什么想法吗?这甚至可行吗?

3 个答案:

答案 0 :(得分:16)

select column_name from all_tab_columns where table_name = 'STUDENTS';

编辑或者,甚至更好

select owner, column_name from all_tab_columns where table_name = 'STUDENTS';

答案 1 :(得分:4)

看看oracle data dictionary,它应该会有所帮助。

答案 2 :(得分:1)

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';