Oracle白板

108 阅读1分钟

记录自己平时会用到的一些脚本。

查询表及注释

select owner, table_name, comments from all_tab_comments
where owner = 'YOUR_OWNER_NAME' and table_type = 'TABLE'
order by table_name

查询列信息

select 
       t1.owner, 
       t1.column_name, 
       t1.data_type, 
       t1.data_length,
       t1.data_precision, 
       t1.data_scale, 
       t1.nullable, 
       t1.data_default, 
       t2.comments
from all_tab_columns t1
left join all_col_comments t2 on t1.owner = t2.owner and t1.table_name = t2.table_name and t1.column_name = t2.column_name
where t1.table_name = 'T_O2O_ORDER'
order by t1.column_id