select col.table_name,
--col.column_id as colorder,
tt.comments,
col.column_name as columnname,
case
when pkcol.column_position > 0 then
'√'else
''end as ispk,
col.data_type as typename,
--decode(col.data_type, 'number', col.data_precision, col.data_length) as length,
col.data_length 占用位元組數,
col.data_precision as preci,
col.data_scale as scale,
case
when col.nullable = 'y' then
'√'else
''end as cisnull,
-- '' as isidentity,
col.data_default as defaultval,
ccom.comments as detext /*,
col.num_distinct as num_distinct*/
from user_tab_columns col,
user_col_comments ccom,
(select aa.table_name,
aa.index_name,
aa.column_name,
aa.column_position
from user_ind_columns aa, user_constraints bb
where bb.constraint_type = 'p'
and aa.table_name = bb.table_name
and aa.index_name = bb.constraint_name
/*and aa.table_name in ('aa')*/
) pkcol,
user_tab_comments tt
where col.table_name = ccom.table_name
and col.column_name = ccom.column_name
and col.table_name = tt.table_name(+)
-- and col.table_name = 'aa'
and col.column_name = pkcol.column_name(+)
and col.table_name = pkcol.table_name(+)
order by col.table_name,col.column_id
SqlServer生成資料字典語句
select 表名 case when a.colorder 1 then d.name else end,表說明 case when a.colorder 1 then isnull f.value,else end,字段序號 a.colorder,欄位名 a.name,標識 case when ...
Oracle自動生成資料字典的SQL語句
讀取oracle表字段名字,型別 含長度 注釋等資訊的sql語句 select col.column name,com.comments,col.data type,col.data length from sys.all tab columns col,sys.all col comments c...
Oracle自動生成資料字典的SQL語句
讀取oracle表字段名字,型別 含長度 注釋等資訊的sql語句 select col.column name,com.comments,col.data type,col.data length from sys.all tab columns col,sys.all col comments c...