对象和记录类型之间的区别

时间:2012-06-01 10:06:07

标签: oracle

我只是好奇了oracle中对象和记录类型之间的区别,更具体地说是以下声明之间的区别

create type emp2_oty is object 
(
 empno  number,
 ename  varchar2(20),
 deptno number
);

create type emp2_nt is table of emp2_oty;

type emp2_oty is record
(
 empno  number,
 ename  varchar2(20),
 deptno number
);

create type emp2_nt is table of emp2_oty;

请详细说明。

2 个答案:

答案 0 :(得分:30)

  • 记录:

       Cannot be stored in the database.
       Cannot be recursively referenced.
       Cannot have logic defined as part of their definition.
    
  • 对象:

       Can be stored as a database table column or as an entire row.
       Can be recursively referenced using the SELF parameter.
       Can have logic defined as part of their definition using member methods.
    

答案 1 :(得分:12)

OBJECT类型可以存储在数据库中,可以在SQL和PL / SQL中使用