summaryrefslogtreecommitdiffstats
path: root/Bachelor/Datenbanken 2/Praktikum4/esql1.sql
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Bachelor/Datenbanken 2/Praktikum4/esql1.sql
downloadStudium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.gz
Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Bachelor/Datenbanken 2/Praktikum4/esql1.sql')
-rw-r--r--Bachelor/Datenbanken 2/Praktikum4/esql1.sql36
1 files changed, 36 insertions, 0 deletions
diff --git a/Bachelor/Datenbanken 2/Praktikum4/esql1.sql b/Bachelor/Datenbanken 2/Praktikum4/esql1.sql
new file mode 100644
index 0000000..b1d631a
--- /dev/null
+++ b/Bachelor/Datenbanken 2/Praktikum4/esql1.sql
@@ -0,0 +1,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;
+/
+