select a.table_name as 表名,user_tab_comments.comments as 表名备注,a.column_name as 列名,
a.data_type as 类型,
decode(a.data_type, 'NUMBER', a.data_precision, a.data_length) as 长度,
a.data_scale as 小数位数,
f.comments as 注释,
a.nullable as 是否允许空,
a.data_default as 缺省值,
decode(e.key, 'Y', 'Y', 'N') as 外键
from user_tab_columns a,user_col_comments f,user_tab_comments,
(select b.table_name,
b.index_name,
b.uniqueness,
c.column_name,
decode(d.constraint_name, 'R', 'Y', 'N') key
from user_indexes b,
user_ind_columns c,
(select constraint_name
from user_constraints
where constraint_type = 'P') d
where b.index_name = c.index_name
and b.index_name = d.constraint_name(+)) e
where a.table_name = e.table_name(+)
and a.column_name = e.column_name(+)
and a.table_name = f.table_name
and a.column_name = f.column_name
and a.table_name = user_tab_comments.table_name
--and a.table_name = 'T_EDR_CON'
--and a.table_name not in('PLAN_TABLE','T_COMMAND_PARAM')
order by a.table_name
a.data_type as 类型,
decode(a.data_type, 'NUMBER', a.data_precision, a.data_length) as 长度,
a.data_scale as 小数位数,
f.comments as 注释,
a.nullable as 是否允许空,
a.data_default as 缺省值,
decode(e.key, 'Y', 'Y', 'N') as 外键
from user_tab_columns a,user_col_comments f,user_tab_comments,
(select b.table_name,
b.index_name,
b.uniqueness,
c.column_name,
decode(d.constraint_name, 'R', 'Y', 'N') key
from user_indexes b,
user_ind_columns c,
(select constraint_name
from user_constraints
where constraint_type = 'P') d
where b.index_name = c.index_name
and b.index_name = d.constraint_name(+)) e
where a.table_name = e.table_name(+)
and a.column_name = e.column_name(+)
and a.table_name = f.table_name
and a.column_name = f.column_name
and a.table_name = user_tab_comments.table_name
--and a.table_name = 'T_EDR_CON'
--and a.table_name not in('PLAN_TABLE','T_COMMAND_PARAM')
order by a.table_name