zoukankan      html  css  js  c++  java
  • Oracle get column/comment definitions for a table

    select a.table_name,c.comments,a.column_name,b.comments,
           decode(a.data_type,'VARCHAR2',a.data_type||'('||a.data_length||')','CHAR',a.data_type||'('||a.data_length||')','NUMBER',decode(a.data_precision,'',a.data_type,a.data_type||'('||a.data_precision||','||a.data_scale||')'),a.data_type),
          'AS '||a.column_name||',',
          decode(b.comments,'','','--'||b.comments),
          decode(b.comments,'','',a.column_name||' AS '||B.COMMENTS||',')
    from dba_tab_cols a,dba_col_comments b,dba_tab_comments c
    where a.table_name='TEST1114'
    and a.owner = 'DB2'
    and a.owner = b.owner
    and b.owner = c.owner
    and a.table_name = b.table_name
    and a.column_name = b.column_name
    and a.table_name = c.table_name
    order by a.column_id; 
    

      


    select a.table_name,c.comments,a.column_name,b.comments,       decode(a.data_type,'VARCHAR2',a.data_type||'('||a.data_length||')','CHAR',a.data_type||'('||a.data_length||')','NUMBER',decode(a.data_precision,'',a.data_type,a.data_type||'('||a.data_precision||','||a.data_scale||')'),a.data_type),      'AS '||a.column_name||',',      decode(b.comments,'','','--'||b.comments),      decode(b.comments,'','',a.column_name||' AS '||B.COMMENTS||',')from dba_tab_cols a,dba_col_comments b,dba_tab_comments cwhere a.table_name='DML_SD_BANK_GL'and a.owner = 'UUPSDB2'and a.owner = b.ownerand b.owner = c.ownerand a.table_name = b.table_nameand a.column_name = b.column_nameand a.table_name = c.table_nameorder by a.column_id; 

    All for u
  • 相关阅读:
    入门篇:Ubuntu用apache做web服务器
    Linux上vi(vim)编辑器使用教程
    vim打开文档和多文档编辑
    vim常用命令
    进行有效编辑的七种习惯
    Ubuntu Nginx 开机自启动
    UBUNTU SERVER 12.04搭建PHP环境
    ubuntu下安装Apache+PHP+Mysql
    Ubuntu 12.04下LAMP安装配置
    data warehouse 1.0 vs 2.0
  • 原文地址:https://www.cnblogs.com/ayumie/p/9957998.html
Copyright © 2011-2022 走看看