SHARE
TWEET

Procedury

a guest Jan 19th, 2020 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE OR REPLACE FUNCTION iloscWolnychMiejsc()
  2. RETURNS TABLE(liczba bigint)
  3.  
  4. AS $$
  5. BEGIN
  6.  
  7.     RETURN QUERY
  8.         select count(id) from parking where id_mieszkanca is null;
  9.  
  10. END;
  11. $$ LANGUAGE plpgsql;
  12.  
  13. CREATE OR REPLACE FUNCTION wyczyscRezerwacje()
  14. RETURNS VOID -- zwraca wartość pustą (null)
  15.  
  16. AS $$
  17. BEGIN
  18.  
  19.     DELETE FROM rezerwacje WHERE (select data_zameldowwania + okres from mieszkancy join rezerwacje using (id_klienta)) < now();
  20.  
  21. END;
  22. $$ LANGUAGE plpgsql;
  23.  
  24. CREATE OR REPLACE FUNCTION wyswietlWolnePokoje()
  25. RETURNS VOID
  26.  
  27. AS $$
  28. BEGIN
  29.  
  30.     SELECT * FROM pokoj WHERE id NOT IN (select id_pokoju from rezerwacje);
  31.  
  32. END;
  33. $$ LANGUAGE plpgsql;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top