现在的位置: 首页 > 综合 > 正文

查看一个表有多少字段,或查有什么字段。

2014年09月05日 ⁄ 综合 ⁄ 共 350字 ⁄ 字号 评论关闭

查看有哪些字段:

select * from all_tab_columns where table_name = '表名(大写)' and owner='用户名';

select * from user_tab_columns where table_name = '表名(大写)';

查看表中有多少字段:

select count(*) from all_tab_columns where table_name = '表名(大写)'and owner='用户名';

select count(*) from user_tab_columns where table_name = '表名(大写)';

 

注意:

每一种语句若不写owner='用户名',则查询出来的字段有可能比预期的多,原因是可能包含其他用户中同名的表字段。

第二种查询,好像是在当前用户下查询,挺方便的。

抱歉!评论已关闭.