Oracle使用之 匯出資料字典

2022-03-30 03:27:53 字數 3232 閱讀 6376

select * from user_tab_comments where table_name like 'web_ply_base%';

select * from dba_tab_comments where table_name like 'web_ply_base%';

select wm_concat(column_name)

from user_tab_cols@link_core

where table_name = upper('t_web_ply_base')

order by column_id;

select wm_concat(column_name)

from dba_tab_cols@link_core

where table_name = upper('web_ply_base')

and owner = 'zssys'

order by column_id;

-- 1. 查詢某錶的資料字典

select a.table_name as "表名",

a.column_name as "欄位名",

decode(a.char_length,

0,decode(a.data_scale,

null,

a.data_type,

a.data_type || '(' || a.data_precision || ',' ||

a.data_scale || ')'),

a.data_type || '(' || a.char_length || ')') as "字段型別1",

a.data_type as "字段型別",

a.data_precision as "有效位",

a.data_scale as "精度值",

a.char_length as "字段長度",

a.nullable as "能否為空"

from sys.user_tab_columns a

where a.table_name = 'tam_address';

-- 2. 具有dba許可權使用者匯出資料字典

select a.table_name as "表名",

a.column_name as "欄位名",

decode(a.char_length,

0,decode(a.data_scale,

null,

a.data_type,

a.data_type || '(' || a.data_precision || ',' ||

a.data_scale || ')'),

a.data_type || '(' || a.char_length || ')') as "字段型別",

a.data_default as "預設值",

a.nullable as "能否為空",

b.comments as "備註"

from sys.all_tab_columns a, sys.dba_col_comments b

where a.owner = b.owner

and a.table_name = b.table_name

and a.column_name = b.column_name

and a.owner = 'guoqiang'

and a.table_name in ('tb_subject',

'tb_subject_balance',

'tb_voucher',

'tb_voucher_details',

'tb_customer',

'tb_voucher_classify_mode',

'tb_voucher_type',

'tb_asset',

'tb_asset_catalog',

'tb_m_dm_assets_liabi_rpt',

'tb_m_dm_profit_rpt',

'tb_m_dm_revenue_rpt',

'tb_m_dm_cost_rpt')

order by a.table_name;

-- 3.一般使用者匯出該使用者下的資料字典

select a.table_name as "表名",

a.column_name as "欄位名",

decode(a.char_length,

0,decode(a.data_scale,

null,

a.data_type,

a.data_type || '(' || a.data_precision || ',' ||

a.data_scale || ')'),

a.data_type || '(' || a.char_length || ')') as "字段型別",

a.data_default as "預設值",

a.nullable as "能否為空",

b.comments as "備註"

from sys.user_tab_columns a, sys.user_col_comments b

where a.table_name = b.table_name

and a.column_name = b.column_name

and a.table_name in ('tb_subject',

'tb_subject_balance',

'tb_voucher',

'tb_voucher_details',

'tb_customer',

'tb_voucher_classify_mode',

'tb_voucher_type',

'tb_asset',

'tb_asset_catalog',

'tb_m_dm_assets_liabi_rpt',

'tb_m_dm_profit_rpt',

'tb_m_dm_revenue_rpt',

'tb_m_dm_cost_rpt')

order by a.table_name;

-----使用下面語句從all_constraints檢視中檢視某錶上的約束:

select constraint_name, table_name, r_owner, r_constraint_name from all_constraints

where table_name = 'tbl_organ_sales' and owner = 'zswx';

oracle 如何匯出資料字典

查詢某錶的資料字典 select a.table name as 表名 a.column name as 欄位名 decode a.char length,0,decode a.data scale,null,a.data type,a.data type a.data precision a.da...

oracle 如何匯出資料字典

查詢某錶的資料字典 select a.table name as 表名 a.column name as 欄位名 decode a.char length,0,decode a.data scale,null,a.data type,a.data type a.data precision a.da...

Oracle資料字典使用入門

每個oracle資料庫中包括乙個被稱為 元資料 的集合,或者說包含用來描述資料庫有關資料結構的資料。包含這些元資料的表和檢視稱為oracle資料字典。本文列出了一些常用的oracle資料字典的查詢方法。下面按類別列出一些oracle使用者常用資料字典的查詢使用方法。一 使用者 檢視當前使用者的預設表...