jotto

Untitled

May 24th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 0.51 KB | None | 0 0
  1. CREATE FUNCTION czy_wypozyczyc() returns TRIGGER
  2. language plpgsql
  3. AS'
  4. begin
  5. if ((select data_wypozyczenia from wypozyczenie where kto_wypozyczyl=$1)<(2012-12-21)) then raise notice ''Brak mozliwosci wypozyczenia'';
  6. return null;
  7. end if;
  8. if ((select data_wypozyczenia from wypozyczenie where kto_wypozyczyl=$1)>=(2012-12-21)) then raise notice ''wypozyczenie mozliwe'';
  9. return new;
  10. end if;
  11. end;
  12. ';
  13.  
  14. CREATE TRIGGER trigg_czy_wyp BEFORE INSERT ON wypozyczenie FOR EACH ROW EXECUTE PROCEDURE czy_wypozyczyc();
Advertisement
Add Comment
Please, Sign In to add comment