发布时间:2023-04-21 19:00
Oracle 查询表基本信息和主键信息
-- 查询表的基本信息
SELECT utc.column_name
,utc.data_type
,utc.data_length
,utc.data_precision
,utc.data_scale
,utc.nullable
,utc.data_default
,ucc.comments
,utc.table_name
FROM dba_tab_columns utc
,dba_col_comments ucc
WHERE utc.table_name = ucc.table_name
AND utc.column_name = ucc.column_name
AND utc.table_name IN (\'your table name \')
ORDER BY column_id;
-- 查询表的 主键 及主键对应的列
SELECT col.column_name
,con.constraint_name
FROM dba_constraints con
,dba_cons_columns col
WHERE con.constraint_name = col.constraint_name
AND con.constraint_type = \'P\'
AND col.table_name = \' you table name\';
--- 刘轶鹤