29

我只是好奇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;

请详细说明。

4

2 回答 2

45
  • record:

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

       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.
    
于 2012-11-06T17:57:08.617 回答
15

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

于 2012-06-01T10:11:39.157 回答