SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE OR REPLACE FUNCTION zaloz_zamowienie(nazwisko TEXT, _produkt TEXT, _ilosc INTEGER RETURNS VOID AS $$
  2.  
  3. DECLARE v_zamowienie_id INTEGER; v_produkt_id INTEGER;
  4.  
  5. BEGIN
  6.  
  7.     v_zamowienie_id := (SELECT id FROM zamowienia WHERE klient_id = (SELECT id FROM klient WHERE nazwisko = nazwisko));
  8.     v_produkt_id := (SELECT id FROM produkt WHERE nazwa = _produkt);
  9.  
  10.  
  11.     INSERT INTO zamowienia_extend(zamowienie_id, produkt_id, ilosc)
  12.     VALUES(v_zamowienie_id, v_produkt_id, _ilosc);
  13.  
  14.  
  15. END;
  16. $$ LANGUAGE plpgsql;
  17.  
  18.  
  19.  
  20. SELECT zaloz_zamowienie_produktu('111222333', 'kawa', 20);
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