当前位置: 首页 > 数据库 > 正文

Oracle查询表结构(列名、数据类型、字段注释)

收藏文章Loading
收藏
(39)
SELECT  T1.TABLE_NAME AS "表名",
        T3.COMMENTS AS "表说明",
        --T1.COLUMN_ID,
        T1.COLUMN_NAME AS "字段名称",
        T1.DATA_TYPE AS "数据类型",
        DECODE(T1.DATA_TYPE,'NUMBER',T1.DATA_PRECISION||','||T1.DATA_SCALE,T1.DATA_LENGTH) AS "长度",
        T1.NULLABLE AS "是否为空",
        T2.COMMENTS AS "字段说明",
        T1.DATA_DEFAULT "默认值"
        --T4.CREATED AS "建表时间"
  FROM COLS T1
  LEFT JOIN USER_COL_COMMENTS T2 
         ON T1.TABLE_NAME = T2.TABLE_NAME
        AND T1.COLUMN_NAME = T2.COLUMN_NAME
  LEFT JOIN USER_TAB_COMMENTS T3 
         ON T1.TABLE_NAME = T3.TABLE_NAME
  LEFT JOIN USER_OBJECTS T4 
         ON T1.TABLE_NAME = T4.OBJECT_NAME
  WHERE  T1.TABLE_NAME = UPPER('TABLE_NAME')  -- 此处表名称替换一下即可
  ORDER BY T1.TABLE_NAME, T1.COLUMN_ID;

本文固定链接: http://www.csyor.com/1071.html - 穿梭于偶然

该日志由 Csyor 于2020年07月20日发表在 数据库 分类下, 通告目前不可用,你可以至底部留下评论。
原创文章转载请注明: Oracle查询表结构(列名、数据类型、字段注释) - 穿梭于偶然
关键字: , , ,

Oracle查询表结构(列名、数据类型、字段注释):目前有3 条留言

  1. 地板
    jordan 11:

    I抦 impressed, I need to say. Actually hardly ever do I encounter a weblog that抯 both educative and entertaining, and let me tell you, you’ve hit the nail on the head. Your thought is excellent; the difficulty is something that not enough individuals are talking intelligently about. I’m very glad that I stumbled across this in my seek for one thing regarding this.

    2020-10-11 14:52 [回复]
  2. 板凳
    kyrie 6:

    There are actually numerous particulars like that to take into consideration. That could be a great point to convey up. I provide the ideas above as basic inspiration but clearly there are questions like the one you carry up the place the most important thing will likely be working in honest good faith. I don?t know if greatest practices have emerged round issues like that, however I’m positive that your job is clearly identified as a good game. Each boys and girls feel the affect of just a moment抯 pleasure, for the remainder of their lives.

    2020-10-09 11:54 [回复]
  3. Nice post. I study something more challenging on different blogs everyday. It’ll at all times be stimulating to read content material from different writers and practice a little bit one thing from their store. I抎 favor to make use of some with the content on my weblog whether you don抰 mind. Natually I抣l offer you a link in your internet blog. Thanks for sharing.

    2020-10-03 09:03 [回复]

发表评论


快捷键:Ctrl+Enter