Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Table value into Associative Array(PLSQL Table) ass

Jeevanantham VOct 27 2017 — edited Oct 28 2017

Hi,

I have table called Employee with Emp_name and Salary. I want to sore this into Assocaitive array for comparision. How can it be done:

Tabledata:

NameSAlary
David5000
James4300
Anderson6000
Karthik7000

Data should be stored Like:

Assoc_arr('David') := 5000;

Assoc_arr('James') := 4300;

Assoc_arr('Anderson') := 6000;

Assoc_arr('Karthik') := 7000;

How it can be achieved?

I tried something, its for your reference:

declare

type Asso_arr is table of varchar2(30) index by binary_integer;

type nes_tab is table of varchar2(30);

As_arr Asso_arr;

name nes_tab := nes_tab();

salary nes_tab := nes_tab();

begin

select salary,name bulk collect into salary,name from EMPLOYEE;

/*No idea ,how to copy into Associative array variable from here. Please support. */

end;

/

This post has been answered by Paulzip on Oct 27 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 25 2017
Added on Oct 27 2017
9 comments
470 views