I'm using postgreSQL 9.3 and I have the following two types of stored procedures (only the statements given):
Code:
INSERT INTO table1 (col1, col2, col3, col4, col5) SELECT $1, $2, $3, $4, $5 WHERE EXISTS (SELECT id FROM table2 q WHERE q.id = $1) RETURNING table1.id;
Code:
DELETE FROM table1 m WHERE m.id = (
SELECT m.id FROM table1 m
WHERE m.col1 = $1
AND