29.06.2013 Views

Elemente de PL/SQL [pdf] - Baze de date

Elemente de PL/SQL [pdf] - Baze de date

Elemente de PL/SQL [pdf] - Baze de date

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CURSORI CU PARAMETRI<br />

DECLARE<br />

CURSOR stu<strong>de</strong>nti (v_cods number :=21,<br />

v_loc varchar2:='BUCURESTI') IS<br />

SELECT nume FROM stud<br />

WHERE cods = v_cods and loc = v_loc;<br />

i number;<br />

BEGIN<br />

FOR i IN 1..5 LOOP -- cod specializare = i*5+1<br />

dbms_output.put_line('Specializarea ' || (i*5+1));<br />

FOR v_stud in stu<strong>de</strong>nti((i*5+1), '<strong>PL</strong>OIESTI') LOOP<br />

dbms_output.put_line(stu<strong>de</strong>nti%rowcount||<br />

' Stu<strong>de</strong>nt: '||v_stud.nume);<br />

END LOOP; -- inchi<strong>de</strong> automat cursorul<br />

END LOOP; -- ciclul FOR i in 1..5<br />

dbms_output.put_line('Cu parametrii impliciti');<br />

FOR v_stud IN stu<strong>de</strong>nti LOOP<br />

dbms_output.put_line(stu<strong>de</strong>nti%rowcount||<br />

' Stu<strong>de</strong>nt: '||v_stud.nume);<br />

END LOOP; -- inchi<strong>de</strong> automat cursorul<br />

END;<br />

F. Radulescu. Curs: <strong>Baze</strong> <strong>de</strong> <strong>date</strong> 82

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!