SELECT
a.table_name 表名,
a.column_name 字段名,
a.data_type 数据类型,
a.data_length 数据长度,
b.comments 说明,
CASE a.column_name
WHEN (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=a.table_name) THEN '是' ELSE '否' END AS 主键,
CASE a.nullable WHEN 'Y' THEN '否' ELSE '是' END
是否为空
FROM
user_tab_columns a,
user_col_comments b
WHERE
a.column_name = b.column_name
AND
a.table_name = b.table_name
order by a.table_name
SQL 输出表结构并且主键
最新推荐文章于 2023-02-22 09:45:38 发布