Pages

Wednesday, March 7, 2012

Each type name is unique when using collections

If you want to create a library of useful PL/SQL code with varrays, there's one very important thing about them to note: Oracle treats each type you define as unique. This means that if we define a type as MyArrayTypeB that's exactly like MyArrayType except for the name, the following consequences result:

  • We can't set variables defined as MyArrayTypeB to equal ones defined as MyArrayType, and vice versa.
  • We can't pass a varray of type MyArrayTypeB as the value for an argument that specifies MyArrayType, and vice versa.
Of course, to pass the values from one type of varray to another, you can always loop through the subscripts and assign the values one by one.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.