Oracle抓取表結構的語句,oracle抓取語句
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