sql查詢檢視列備註

zgy13121發表於2008-10-18

Select A.COLUMN_NAME COLUMN_NAME, B.COMMENTS, decode(A.DATA_TYPE,'DATE',A.DATA_TYPE, 'NUMBER',decode(A.DATA_SCALE,0,A.DATA_TYPE||'('||a.DATA_PRECISION||')', A.DATA_TYPE||'('||a.DATA_PRECISION||','||A.DATA_SCALE||')'), A.DATA_TYPE||'('||a.DATA_LENGTH||')' ) DATA_TYPE

From USER_TAB_COLS A ,

(

Select * From (Select a.*,row_number() over(partition By column_name order by comments) rn From( Select Distinct COLUMN_NAME,COMMENTS

From USER_COL_COMMENTS

Order By COLUMN_NAME DESC,COMMENTS Nulls Last ) a ) Where rn=1

) B

Where A.COLUMN_NAME=B.COLUMN_NAME And lower(A.TABLE_NAME) =lower('v_tran_aai02') Order By a.COLUMN_ID

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11419868/viewspace-1012081/,如需轉載,請註明出處,否則將追究法律責任。

相關文章