`

sql实现查看oracle的表结构及备注(comments)

阅读更多

查看表结构:

    看字段名与数据类型
    select   *   from   cols     WHERE   TABLE_name=upper( 'table_name ')

    查看主键:
    select   *   from   user_constraints   where   constraint_type= 'P '
    and   TABLE_name=upper( 'table_name ')


  另外:

    在SQLPLUS中,用     desc   tablename
    在PL/SQL工具中,可以通过视图user_tab_columns   查看
    select   *   from   user_tab_columns   where   table_name   =   upper(tablename)
   

 

 

查看备注:

     --查看表的comment
     select   *   from   all_tab_comments   where   table_name= upper(tablename) ;

     --查看列的comment
     select   *   from   all_col_comments   where   table_name=upper(tablename) ;

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics