Oracle PL/SQL/PL SQL/Table of Object

Материал из SQL эксперт
Перейти к: навигация, поиск

An index-by table of an object type.

 
SQL>
SQL> CREATE OR REPLACE TYPE MyObject AS OBJECT (
  2    field1 NUMBER,
  3    field2 VARCHAR2(20),
  4    field3 DATE);
  5  /
Type created.
SQL>
SQL> DECLARE
  2    TYPE ObjectTab IS TABLE OF MyObject
  3      INDEX BY BINARY_INTEGER;
  4    v_Objects ObjectTab;
  5  BEGIN
  6    v_Objects(1) := MyObject(1, NULL, NULL);
  7    v_Objects(1).field2 := "Hello World!";
  8    v_Objects(1).field3 := SYSDATE;
  9  END;
 10  /
PL/SQL procedure successfully completed.