column_name和qualified_col_name之间有什么区别?

时间:2014-10-16 08:49:27

标签: oracle

关于标准视图user_tab_col的以下查询:

select * from user_tab_cols;

在Oracle上返回列column_namequalified_col_name

有什么区别?

1 个答案:

答案 0 :(得分:4)

qualified_col_name表示XML表的完整列路径。基本上它存储了此列的表达式。对于常规列,它将等于column_name

如果你跑:

select owner, table_name, column_name, data_type, qualified_col_name
  from all_tab_cols
 where column_name <> qualified_col_name;

您将看到XDB架构中XML表中返回的列。

例如:

OWNER  TABLE_NAME       COLUMN_NAME   DATA_TYPE           QUALIFIED_COL_NAME
XDB    XDB$SIMPLE_TYPE  SYS_NC00074$  XDB$APPINFO_LIST_T  "XMLDATA"."RESTRICTION"."MIN_INCLUSIVE"."ANNOTATION"."APPINFO"

更新: 对于对象表qualified_col_name存储类型转换和访问属性的表达式。例如:

create or replace type test1_obj as object(
   n1 number,
   n2 number,
   s1 varchar2(10),
   s2 varchar2(20)
)
not final;

create or replace type test2_obj under test1_obj(
  d1 date,
  d2 date
)
not final;

create table object_table of test1_obj;

select column_name, data_type, qualified_col_name 
  from user_tab_cols
where table_name = 'OBJECT_TABLE'
 order by internal_column_id;

对于为test2_obj类型的实例保留的最后2个隐藏系统列,我们可以看到:

COLUMN_NAME     DATA_TYPE   QUALIFIED_COL_NAME
SYS_NC00010$    DATE        TREAT(SYS_NC_ROWINFO$ AS "TEST"."TEST2_OBJ")."D1"
SYS_NC00011$    DATE        TREAT(SYS_NC_ROWINFO$ AS "TEST"."TEST2_OBJ")."D2"