How to we pass default value as null to Associative Array in Procedure

oracleplsql

How can we pass NULL as a default value to an associative array?

I have tried using

DEFAULT cast (null as t_test)

Here t_test is an associative array.

Best Answer

Casting it as NULL should work fine:

DECLARE
  TYPE t_test IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;

  PROCEDURE test_me ( in_test IN t_test DEFAULT CAST( NULL AS t_test ) )
  AS
  BEGIN
    dbms_output.put_line( in_test.COUNT );
  END test_me;

BEGIN
  test_me();
END;