您的位置:首页 > 数据库 > Oracle

Oracle抓取表结构的语句

2015-06-03 11:32 363 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: