Advertisement
Enter121

Untitled

May 26th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. create or replace function pokazSwojeTowary() returns trigger
  2. language plpgsql
  3. as
  4. '
  5. DECLARE
  6. id int;
  7. pl int;
  8. BEGIN
  9. select kto_wypozyczyl FROM wypozyczenie into id ORDER BY data_wypozyczenia DESC limit 1;
  10. select co_wypozyczyl FROM wypozyczenie into pl ORDER BY data_wypozyczenia DESC limit 1;
  11. select tytul, cena from plyta where numer in (select co_wypozyczyl from wypozyczenie where kto_wypozyczyl=id);
  12. return null;
  13. end ';
  14.  
  15. create trigger trwypozyczenie after insert on wypozyczenie for each statement execute procedure pokazSwojeTowary();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement