Calling a stored procedure within a stored procedure
I am trying to call a function within a function using sql on postgres 9.3. This question is related to another post by me . I have written the below function. So far I have failed to incorporate any kind of save-output (COPY) statement, so I am trying to work around this by creating a nested function print-out function. CREATE FUNCTION retrieve_info(TEXT, TEXT) RETURNS SETOF retrieve_info_tbl AS $$ SELECT tblA.id, tblA.method, tblA.species, tblA.location FROM tblA WHERE method=$1 AND species=$2 GROUP BY id, method, species ORDER BY location $$ LANGUAGE 'sql'; The above function works. An