Saturday, April 6, 2013

Referencing a Nested Table Element

Referencing a Nested Table Element
DECLARE
  TYPE Roster IS TABLE OF VARCHAR2(15);
  names Roster := Roster('D Caruso', 'J Hamil', 'D Piro', 'R Singh');
  PROCEDURE verify_name(the_name VARCHAR2) IS
  BEGIN
    DBMS_OUTPUT.PUT_LINE(the_name);
  END;
BEGIN
  FOR i IN names.FIRST .. names.LAST
  LOOP
      IF names(i) = 'J Hamil' THEN
        DBMS_OUTPUT.PUT_LINE(names(i)); -- reference to nested table element
      END IF;
  END LOOP;
  verify_name(names(3));  -- procedure call with reference to element
END;
/

No comments:

Post a Comment

Troubleshooting ACFS-07981: Metadata Validation Errors

  Troubleshooting ACFS-07981: Metadata Validation Errors Introduction The ACFS-07981 error indicates that an attempt to run an online file ...