-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab07.sql
More file actions
49 lines (46 loc) · 1.11 KB
/
lab07.sql
File metadata and controls
49 lines (46 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
SET SERVEROUTPUT ON;
-- 0
-- UPDATE studenti set bursa = bursa + 10 WHERE bursa > 300;
<< global >> DECLARE
v_cartofi INTEGER := 10;
BEGIN
<< local >> DECLARE
v_cartofi studenti.id%TYPE := 15;
BEGIN
SELECT id
INTO local.v_cartofi
FROM studenti
WHERE ROWNUM = 1;
dbms_output.put_line('ay lmao 1 ' || local.v_cartofi);
dbms_output.put_line('ay lmao 2 ' || global.v_cartofi);
END;
END;
-- 1
DECLARE
CURSOR lista_studenti IS
SELECT *
FROM studenti;
v_std_linie lista_studenti%ROWTYPE;
BEGIN
OPEN lista_studenti;
LOOP
FETCH lista_studenti INTO v_std_linie;
EXIT WHEN lista_studenti%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(v_std_linie.nume
|| ' '
|| v_std_linie.data_nastere);
END LOOP;
CLOSE lista_studenti;
END;
-- 2
DECLARE
CURSOR lista_studenti IS
SELECT *
FROM studenti;
BEGIN
FOR v_std_linie IN lista_studenti LOOP
DBMS_OUTPUT.PUT_LINE(v_std_linie.nume
|| ' '
|| v_std_linie.data_nastere);
END LOOP;
END;