select Lower(column_name) "字段名",
decode(data_type,'VARCHAR2',data_type||'('||data_length||')','NUMBER',data_type||'('||data_length||')') "字段编码",
(select decode(column_name,c.COLUMN_NAME,'TRUE','FALSE')
from user_cons_columns cu, user_constraints au
where cu.constraint_name = au.constraint_name
and au.constraint_type = 'P' and au.table_name = c.table_name) "主要的",
decode(nullable,'N','TRUE','Y','FALSE') "强制",(select comments from user_col_comments
where table_name=c.TABLE_NAME and column_name = c.COLUMN_NAME ) "注释"
from user_tab_columns c where table_name = 'table_name ' order by column_id
sql简单实现查询某个表字段名,是否主键,是否非空及备注信息
最新推荐文章于 2023-01-16 16:15:45 发布