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

Oracle抓取表结构的语句

时间:2015-06-03 13:17:25      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

oracle ---------------------------------------
 
SELECT case when t.COLUMN_ID=1 then t.table_name end table_name,
       case when t.COLUMN_ID=1 then t2.comments end table_comments,
       t.COLUMN_ID,t.colUMN_NAME,t1.comments,case when t3.COLUMN_NAME is not null then ‘Y‘ else NULL end primary_key
       ,t.DATA_TYPE,t.DATA_LENGTH,t.DATA_PRECISION,t.data_scale,t.nullable
  FROM User_Tab_Cols t, User_Col_Comments t1, User_Tab_Comments t2,user_cons_columns t3
WHERE t.table_name = t1.table_name
    AND t.column_name = t1.column_name
    and t.table_name=t2.table_name
    and t.table_name=t3.table_name(+) and t.COLUMN_NAME=t3.COLUMN_NAME(+) and t3.position(+)>0
    and t.TABLE_NAME=‘S_SALARY‘
    order by t.COLUMN_ID

Oracle抓取表结构的语句

标签:

原文地址:http://www.cnblogs.com/jackxun/p/4548677.html

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