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
  • 相关阅读:
    找工作时写过的部分代码
    python编码格式
    dataframe删掉某列
    结巴分词出现AttributeError: 'float' object has no attribute 'decode'错误
    python转换图片格式
    感受野
    swift3 xib自定义view
    iOS 弹出键盘,输入框上移问题
    支付宝问题
    XCode6.0的iOS免证书真机测试方法(MAC及黑苹果均有效)
  • 原文地址:https://www.cnblogs.com/ayumie/p/9957998.html
Copyright © 2011-2022 走看看