ORACEL 表及字段描述
select ROWNUM 序号, ut.table_name 表名, utc.comments 表说明
from user_tables ut
left join user_tab_comments utc
on ut.table_name = utc.table_name
order by ut.table_name
select row_number()over( partition by utc.table_name order by utc.COLUMN_ID, ROWNUM ) as 序号,
utc.table_name as 表名,
utc.column_name as 列名,
utc.data_type as 数据类型,
utc.data_length as 长度,
utc.data_precision as 精度,
utc.data_Scale 小数位数,
case when exists ( select col.column_name from user_constraints con,user_cons_columns col
where con.constraint_name=col.constraint_name and con.constraint_type='P' and col.table_name=ucc.table_name and col.column_name = utc.column_name )
then '√' else '' end as 主键,
case when utc.nullable = 'Y' then '√' else '' end as 允许空,
utc.data_default as 默认值,
ucc.comments as 列说明
from
user_tab_columns utc,user_col_comments ucc
where utc.table_name = ucc.table_name and utc.column_name = ucc.column_name
order by utc.table_name,序号