Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create or replace function pokazSwojeTowary() returns trigger
- language plpgsql
- as
- '
- DECLARE
- id int;
- pl int;
- rec record;
- BEGIN
- select kto_wypozyczyl FROM wypozyczenie into id ORDER BY data_wypozyczenia DESC limit 1;
- select co_wypozyczyl FROM wypozyczenie into pl ORDER BY data_wypozyczenia DESC limit 1;
- FOR rec in (select * from plyta where numer!=pl and numer in (select co_wypozyczyl from wypozyczenie where kto_wypozyczyl=id))
- loop
- raise notice '' % %'',rec.tytul, rec.cena;
- end loop;
- return null;
- end ';
- create trigger pokaz after insert on wypozyczenie for each statement execute procedure pokazSwojeTowary();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement