Varrays

Course table

COURSE_IDNAMEPRICE
1SQL 110
2SQL 250
3HTML510

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