Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PL/SQL (step through table or array)

Status
Not open for further replies.

StickyBit

Technical User
Jan 4, 2002
264
CA
Hi folks,

this is a newbie question, using a loop how do I step through the table (array) I have created.

DECLARE

TYPE skill_table IS TABLE OF skill.skill_description%TYPE INDEX BY BINARY_INTEGER;
current_skill_table SKILL_TABLE;

CURSOR skill_cursor IS
SELECT skill_id, skill_description
FROM skill;

skill_cursor_row skill_cursor%ROWTYPE;

BEGIN
FOR skill_cursor_row IN skill_cursor LOOP
current_skill_table(skill_cursor_row.skill_id) := skill_cursor_row.skill_description;
END LOOP;


--would I do something like this

FOR v_some_var IN table_name LOOP

END LOOP;

--or

LOOP

-- process values

EXIT WHEN v_some_var = table_name.LAST

END LOOP;





 
v_some_var := table_name.FIRST;
LOOP
exit when v_some_var is null;
....
v_some_var := table_name.NEXT(v_some_var);
END LOOP;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top