查询oracle的列信息与字符集

查询字符集与比较排序规则:

select userenv('language') from dual;
select parameter,value from nls_database_parameters where parameter in('NLS_CHARACTERSET','NLS_COMP','NLS_SORT');

 

查询列名,类型,是否可空,注释,默认值:
select tc.column_name,
decode(tc.data_type,
'NUMBER',
NVL2(DATA_PRECISION,
'NUMBER(' || tc.DATA_PRECISION || ',' || tc.DATA_SCALE || ')',
'NUMBER'),
'VARCHAR2',
'VARCHAR2(' || tc.DATA_LENGTH || ')',
'CHAR',
'CHAR(' || tc.DATA_LENGTH || ')',
'RAW',
'RAW(' || tc.DATA_LENGTH || ')',
tc.DATA_TYPE) as column_type,
NULLABLE,
cc.comments,
DATA_DEFAULT
from dba_tab_columns tc
join dba_col_comments cc
on tc.OWNER = cc.owner
and tc.TABLE_NAME = cc.table_name
and tc.COLUMN_NAME = cc.column_name
WHERE tc.owner = 'SCOTT'
and tc.table_name = 'TTTTT'
order by tc.COLUMN_ID;

 

posted on 2023-03-07 22:46  JennyYu  阅读(106)  评论(0编辑  收藏  举报