summaryrefslogtreecommitdiffstats
path: root/Bachelor/Datenbanken 2/Praktikum4/esql1.sql
blob: b1d631a0ec4d23c5a7d8aaa124e7b6448fd566b3 (plain)
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
-- Anonymer PL/SQL-Block

-- Deklarationsblock
declare
   cursor c is select gehalt from angestellter
         for update of gehalt;

   v_gehalt angestellter.gehalt%type;

-- Ausf�hrungsblock
begin
   -- Cursor �ffnen
   open c;

   -- erste Zeile lesen
   fetch c into v_gehalt;

   -- alle Zeilen der Ergebnistabelle lesen
   while c%found loop

    if   v_gehalt > 10000
    then update angestellter 
         set gehalt = gehalt * 1.03
         where current of c;
    else update angestellter 
         set gehalt = gehalt * 1.02
         where current of c;
    end if;

    fetch c into v_gehalt;

   end loop;

end;
/