SET sql_mode=oracle;
SET NAMES utf8mb4;

--echo #
--echo # MDEV-34319 DECLARE TYPE .. TABLE OF .. INDEX BY in stored routines
--echo #

--echo #
--echo # Create a relatively big array, then search in it
--echo #

DELIMITER $$;
CREATE PROCEDURE p1 AS
  TYPE assoc_t IS TABLE OF VARCHAR(32) INDEX BY INT;
  assoc assoc_t;
BEGIN
  FOR i IN 0..1024*128
  LOOP
    assoc(i):= CONCAT('value', i);
  END LOOP;
  CREATE TEMPORARY TABLE t1 (a INT, b VARCHAR(32));
  FOR i IN 0..16
  LOOP
    INSERT INTO t1 VALUES (i*10, assoc(i*10));
  END LOOP;
  SELECT * FROM t1;
  DROP TEMPORARY TABLE t1;
END;
$$
DELIMITER ;$$
CALL p1;
DROP PROCEDURE p1;
