I’m doing a stored procedure (function) on a query I already had and I’m going crazy.
I did this query
c.child_id, s.child_id2, l.letter_id, w.toy_id FROM CHILD c JOIN LETTER l ON c.child_id = l.child_id JOIN WISHED_TOY w ON l.letter_id = w.letter_id JOIN SIBLING s ON c.child_id = s.child_id1 WHERE w.toy_id IN ( SELECT w1.toy_id FROM CHILD c1 JOIN LETTER l1 ON c1.child_id = l1.child_id AND c1.child_id = s.child_id2 JOIN WISHED_TOY w1 ON l1.letter_id = w1.letter_id ) group by w.toy_id,c.child_id, s.child_id2, l.letter_id order by w.toy_id
Well, the stored procedure that I’m doing has to update the data in a table passing as a parameter the child_id. And I want create this procedure:
CREATE OR REPLACE FUNCTION update_family_toys(p_child_id SMALLINT) RETURNS VOID
Of the procedure I have done the controls in case the number that happened to him by parameter is not valid and others, my problem is how to pass the query to the procedure, if someone can throw me a cable … I’m going around and around .. This is what I have echoed.
CREATE OR REPLACE FUNCTION update_family_toys (p_child_id SMALLINT) RETURNS void AS ' DECLARE l_child_id SMALLINT; l_sibling_id SMALLINT; l_letter_id SMALLINT; l_toy_id SMALLINT; BEGIN
IF NOT EXISTS (SELECT child_id from child where child_id = p_child_id) THEN RAISE EXCEPTION '' THE CHILD DOES NOT EXIST ''; END IF;
IF NOT EXISTS (SELECT * FROM SIBLING WHERE CHILD_ID1 = P_CHILD_ID) THEN RAISE EXCEPTION '' THE CHILD YOU HAVE BROUGHT DOES NOT HAVE BROTHERS ''; END IF;
FOR l_child_id, l_sibling_id, l_letter_id, l_toy_id
IN SELECT c.child_id, s.child_id2, l.letter_id, w.toy_id FROM CHILD c JOIN LETTER l ON (C.CHILD_ID = P_CHILD_ID) = L.CHILD_ID
END; 'LANGUAGE PLPGSQL;
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!