Tuesday, October 20, 2015

Oracle Collection Assignments and Equality Tests

Assignments and Equality Tests

Assignments can only be made between collections of the same type. Not types of similar structures, or with the same name in different packages, but literally the same type.

The following example shows a successful assignment between two collections of the same type.

DECLARE
  TYPE table_type IS TABLE OF NUMBER(10);
  v_tab_1  table_type;
  v_tab_2  table_type;
BEGIN
  -- Initialise the collection with two values.
  v_tab_1 := table_type(1, 2);

  -- Assignment works.
  v_tab_2 := v_tab_1;
END;
/

PL/SQL procedure successfully completed.

No comments:

Post a Comment