Details
-
New Feature
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
Let's add support for INDEX BY tables (associative arrays) in the DECLARE section of stored routines and anonymous blocks, with this syntax:
DECLARE
|
TYPE type_name TABLE OF rec_type_name INDEX BY idx_type_name; |
The INDEX BY clause should support at least integer and string data types.
rec_type_name should support scalar both types and records:
DECLARE
|
TYPE salary IS TABLE OF NUMBER INDEX BY VARCHAR2(20); |
salary_list salary;
|
name VARCHAR2(20); |
BEGIN
|
salary_list('Rajnisj') := 62000; |
salary_list('James') := 78000; |
name:= salary_list.FIRST; |
WHILE name IS NOT NULL |
LOOP
|
dbms_output.put_line(name || ' ' || TO_CHAR(salary_list(name))); |
name:= salary_list.NEXT(name); |
END LOOP; |
END; |
/
|
DECLARE
|
TYPE person_t IS RECORD |
(
|
first_name VARCHAR(64), |
last_name VARCHAR(64) |
);
|
TYPE table_of_peson_t IS TABLE OF person_t INDEX BY VARCHAR(20); |
person_by_nickname table_of_peson_t;
|
nick VARCHAR(20); |
BEGIN
|
person_by_nickname('Monty') := person_t('Michael', 'Widenius'); |
person_by_nickname('Serg') := person_t('Sergei ', 'Golubchik'); |
nick:= person_by_nickname.FIRST; |
WHILE nick IS NOT NULL |
LOOP
|
dbms_output.put_line(nick || ' ' || TO_CHAR(person_by_nickname(nick))); |
name:= person_by_nickname.NEXT(nick); |
END LOOP; |
END; |
/
|
Attachments
Issue Links
- blocks
-
MDEV-13139 CREATE PACKAGE: package-wide declarations
- Stalled
-
MDEV-20030 sql_mode="oracle" does not support FOR ALL ... BULK COLLECT
- Open
-
MDEV-34323 Oracle compatibility project 3
- Open
-
MDEV-34560 Qualified package data types
- Open
-
MDEV-34569 Oracle compatibility project 4
- Open
- is blocked by
-
MDEV-34317 DECLARE TYPE type_name IS RECORD (..) with scalar members in stored routines
- In Testing
- relates to
-
MDEV-34648 Support Composite Variable, Associative Arrays, in Procedure Parameter out
- Open