summaryrefslogtreecommitdiffstats
path: root/Bachelor/Datenbanken 2/Praktikum4/assistenz_trigger.sql
blob: d252b1c7fffa636e4a9e2ff3dd5ce2feaa300fcf (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
create or replace trigger ASSISTENZ_INSERT
before insert on assistenz
for each row

declare
    Eingabe_nicht_zulaessig exception;
    pragma exception_init (Eingabe_nicht_zulaessig, -20001);

    antwort integer;

begin

    antwort := pruef_operation(:new.persnr,:new.opnummer);

    if antwort = 0
    then raise Eingabe_nicht_zulaessig;
    end if;

    exception
    when Eingabe_nicht_zulaessig then
         raise_application_error
         (-20001, 'Chirurg ' || :new.persnr || ' leitet diese Operation!');

end;
/