Varrays

Course table

COURSE_ID NAME PRICE
1 SQL 1 10
2 SQL 2 50
3 HTML5 10

Varrays (variable-size arrays)

DECLARE
	TYPE name IS VARRAY(250) OF VARCHAR2(25);
	course_name name;   
BEGIN
	course_name := name('SQL 1', 'SQL 2', 'HTML5');
	FOR i IN 1 .. course_name.COUNT LOOP
		FOR x IN (SELECT * FROM course WHERE name=course_name(i))
		LOOP
			dbms_output.put_line('ID: '||x.course_id||' - Name: '||x.name);
		END LOOP; 
	END LOOP;
END;
/

Output

ID: 1 – Name: SQL 1
ID: 2 – Name: SQL 2
ID: 3 – Name: HTML5