Oracle 中查看所有表和字段

获取表:

  select table_name from user_tables; // 当前用户的表

  select table_name from all_tables; // 所有用户的表

  select table_name from dba_tables; // 包括系统表

  select table_name from dba_tables where owner='用户名'; // 当前用户的表

获取表字段:

  select * from user_tab_columns where table_name='用户表名';

  select * from all_tab_columns where table_name='用户表名';

  select * from dba_tab_columns where table_name='用户表';

获取表注释:

  select * from user_tab_comments;

  select * from all_tab_comments;

  select * from dba_tab_comments;

获取字段注释:

  select * from user_col_comments;

  select * from all_col_comments;

  select * from dba_col_comments;

显示表结构:

  SQL> desc tablename;

 

查询修改字段长度

select 'ALTER TABLE '||t.TABLE_NAME||' MODIFY APPROVAL_NO VARCHAR2(100 CHAR);',t.TABLE_NAME,t.COLUMN_NAME,t.CHAR_LENGTH from user_tab_columns t where t.column_name='APPROVAL_NO'
posted @ 2020-10-23 15:02  systemctl1  阅读(993)  评论(0编辑  收藏  举报