码迷,mamicode.com
首页 > 数据库 > 详细

oracle 查询表结构

时间:2020-05-25 12:05:45      阅读:66      评论:0      收藏:0      [点我收藏+]

标签:cal   查询   col   HERE   整数   length   oracl   表结构   comment   

SELECT 
    B.TABLE_NAME AS ‘表名‘,
    C.COMMENTS  AS ‘表说明‘, 
    B.COLUMN_ID AS ‘字段序号‘, 
    B.COLUMN_NAME  AS ‘字段名‘, 
    B.DATA_TYPE AS ‘字段数据类型‘, 
    B.DATA_LENGTH  AS ‘数据长度‘, 
    B.DATA_PRECISION AS ‘整数位‘,        
    B.DATA_SCALE  AS ‘小数位‘,        
    A.COMMENTS  AS ‘字段说明‘   
FROM 
    ALL_COL_COMMENTS A, 
    ALL_TAB_COLUMNS B, 
    ALL_TAB_COMMENTS C 
WHERE 
    A.TABLE_NAME IN (SELECT U.TABLE_NAME FROM USER_ALL_TABLES U)    
    AND A.OWNER = B.OWNER    
    AND A.TABLE_NAME = B.TABLE_NAME    
    AND A.COLUMN_NAME = B.COLUMN_NAME    
    AND C.TABLE_NAME = A.TABLE_NAME    
    AND C.OWNER = A.OWNER    
    AND A.OWNER = ‘xxx_db_name‘ --其中xxx_db_name为DB用户名
    AND A.TABLE_NAME like ‘%xxx_table_name%‘ --xxx_table_name为表名称
ORDER BY A.TABLE_NAME, B.COLUMN_ID;

oracle 查询表结构

标签:cal   查询   col   HERE   整数   length   oracl   表结构   comment   

原文地址:https://www.cnblogs.com/zhang-wenbin/p/12956058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!