Hi Tom,
Need your help. I searched about the error but couldn't find anything about it.
Below is the snippet from Oracle's Database PL/SQL Language Reference:
"LIMIT is a function that returns the maximum number of elements that the collection can have. If the collection has no maximum number of elements, LIMIT returns NULL. Only a varray has a maximum size."
Test code: In the following code block, the LIMIT collection method works only when "typ_associative_array" is INDEX BY PLS_INTEGER (or BINARY_INTEGER) but doesn't when INDEX BY <string-data-type> say VARCHAR2(10) or STRING(10).
DECLARE
TYPE typ_associative_array IS TABLE OF DATE INDEX BY VARCHAR2(10);
v_typ_associative_array typ_associative_array;
BEGIN
DBMS_OUTPUT.PUT_LINE(NVL(TO_CHAR(v_typ_associative_array.LIMIT),'Collection''s limit is Undefined'));
END;
/
Output:Error report -
ORA-06550: line 5, column 62:
PLS-00306: wrong number or types of arguments in call to 'LIMIT'
ORA-06550: line 5, column 5:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
I'd say that is a documentation bug that shows the history of the LIMIT function.
I had to go all the way back to the 8i documentation to see that the LIMIT function exists, but INDEX BY VARCHAR2 did *not* exist, and thus the text was valid. I suspect INDEX BY VARCHAR2 came along and no-one updated the docs to reflect that LIMIT did not apply.
I'll log a doc bug