SQL: Abfrage Tabellen mit Spaltenliste, Datentypen und Kommentaren
kleine Abfrage zu Tabellen und Spalten (inkl. Datentypen und Kommentare):
select TC.TABLE_NAME
, TC.COLUMN_NAME
, TC.DATA_TYPE
, TC.DATA_LENGTH
, COC.COMMENTS
, TC.COLUMN_ID
from USER_TAB_COLS TC
join USER_COL_COMMENTS COC on TC.TABLE_NAME = COC.TABLE_NAME and TC.COLUMN_NAME = COC.COLUMN_NAME
where TC.TABLE_NAME in ('D_1', 'D_2', 'D_3')
union all
select TABLE_NAME
, null
, null
, null
, COMMENTS
, 0
from USER_TAB_COMMENTS
where TABLE_NAME in ('D_1', 'D_2', 'D_3')
order by TABLE_NAME, COLUMN_ID
;
select TC.TABLE_NAME
, TC.COLUMN_NAME
, TC.DATA_TYPE
, TC.DATA_LENGTH
, COC.COMMENTS
, TC.COLUMN_ID
from USER_TAB_COLS TC
join USER_COL_COMMENTS COC on TC.TABLE_NAME = COC.TABLE_NAME and TC.COLUMN_NAME = COC.COLUMN_NAME
where TC.TABLE_NAME in ('D_1', 'D_2', 'D_3')
union all
select TABLE_NAME
, null
, null
, null
, COMMENTS
, 0
from USER_TAB_COMMENTS
where TABLE_NAME in ('D_1', 'D_2', 'D_3')
order by TABLE_NAME, COLUMN_ID
;
Kommentare
Kommentar veröffentlichen