Organizational Research By

Surprising Reserch Topic

pl sql bulk collect into associative array with sparse key


pl sql bulk collect into associative array with sparse key  using -'oracle,plsql,associative-array'

I want to execute a SQL query inside PL/SQL and populate the results into an associative array, where one of the columns in the SQL becomes the key in the associative array. For example, say I have a table Person with columns

PERSON_ID   INTEGER      PRIMARY KEY
PERSON_NAME VARCHAR2(50)


...and values like:

 PERSON_ID  |  PERSON_NAME
 ------------------------
 6          |  Alice
 15         |  Bob
 1234       |  Carol


I want to bulk collect this table into a TABLE OF VARCHAR2(50) INDEX BY INTEGER such that the key 6 in this associative array has the value Alice and so on. Can this be done in PL/SQL? If so, how?
    

asked Oct 3, 2015 by param.oncemore
0 votes
54 views



Related Hot Questions

2 Answers

0 votes
NULL
answered Oct 3, 2015 by devkumargupta
0 votes
NULL
answered Oct 3, 2015 by gauravsinghal83

...