4

在过程或函数中声明的 Oracle RECORD TYPE 是本地的,因此它可能只在本地使用。如何声明一个全局的 RECORD TYPE,可以在 DB 中全局的所有过程和函数中使用?

4

2 回答 2

5

Record types cannot be created as a separate schema object, so to make a Record type publicly available the type is usually declared in a package specification, or a package body to be available only in the scope of that package.

于 2012-10-08T10:14:01.267 回答
3

在包中使用对象类型的基本示例。

CREATE OR REPLACE TYPE test_rec IS OBJECT
(
 ID             VARCHAR2(30)
 ,TYPE               VARCHAR2(30)
);
/

CREATE OR REPLACE TYPE test_NT AS TABLE OF test_rec;
/

declare
 v_test_NT   test_NT;

begin
select test_rec (id
                ,type
                 )
        BULK COLLECT INTO v_test_NT  
 FROM test ;

--use it as you want

end;
于 2012-10-08T10:24:14.983 回答