Advertisement
Pyrone

Untitled

Jun 27th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE OR REPLACE FUNCTION public.provjeri_ekspertizu()
  2.  RETURNS trigger
  3.  LANGUAGE plpgsql
  4. AS $function$
  5.   declare
  6.  
  7.     ekspertizaId int;
  8.     brojiEkspertize int;
  9.   begin
  10.  
  11.     select ekspertiza_id into ekspertizaId
  12. from zaposlenik where id = new.zaposlenik_id;
  13.  
  14.     select count(*) into brojiEkspertize
  15. from zahtjeva where zahtjeva.projekt_id = new.projekt_id and zahtjeva.ekspertiza
  16.  
  17.  
  18.     if brojiEkspertize !=0 then
  19.       raise notice 'Uredu!';
  20.       return new;
  21.     else
  22.       raise exception 'Nema potrebne ekspertize';
  23.       return null;
  24.     end if;
  25. end; language plpgsql;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement