获取所有的表

-- 获取所有用户的表
select table_name from all_tables;
-- 获取当前用户的表
select table_name from user_tables;
-- 获取所有表(包括系统表)
select table_name from dba_tables;
-- 获取指定用户下的所有表
select table from dba_tables where owner = 'xxx';

查看表结构

  1. 使用 desc 表名 进行查看。(只有在命令行模式下可以使用,通过其他客户端链接的如果没有命令行模式则无法使用)
  2. 通过SQL进行查看:
    • 粗略查询:
    select * from user_tab_columns where table_name = '表名';
    
    • 精确查询:
    select COLUMN_NAME,DATA_TYPE,DATA_LENGTH from user_tab_columns where table_name='表名';
    

查看表的注释

select * from user_tab_comments where table_name = '表名';

查看表中字段的注释

select * from user_col_comments where table_name = '表名';

查看表中的序列

  • 查看表中所有序列
select * from user_sequences;
  • 查看特定的序列
select * from user_sequences  where  sequence_name like '%T_SELL_BRAND%'
;
select * from user_sequences  where  sequence_name='SEQ_T_SELL_BRAND'
;

更多推荐

Oracle使用SQL语句查看表的相关数据(表结构、注释等)