Advertisement
Enter121

Untitled

May 26th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 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. rec record;
  9. BEGIN
  10. select kto_wypozyczyl FROM wypozyczenie into id ORDER BY data_wypozyczenia DESC limit 1;
  11. select co_wypozyczyl FROM wypozyczenie into pl ORDER BY data_wypozyczenia DESC limit 1;
  12.  
  13.  
  14. FOR rec in (select * from plyta where numer!=pl and numer in (select co_wypozyczyl from wypozyczenie where kto_wypozyczyl=id))
  15. loop
  16. raise notice '' % %'',rec.tytul, rec.cena;
  17. end loop;
  18.  
  19. return null;
  20. end ';
  21.  
  22. create trigger pokaz after insert on wypozyczenie for each statement execute procedure pokazSwojeTowary();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement