KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How to create a function which takes as argument integer[] parameter and executing query with IN clause with this parameter in loop. In loop I want execute next select and result of this query I would like return. Something like that: CREATE OR REPLACE FUNCTION function_which_i_want(my_argument integer[]) RETURNS my_schema_and_table[] AS $BODY$ DECLARE result my_schema_and_table[]; BEGIN FOR l IN SELECT * FROM table2 WHERE id in (my_argument) LOOP SELECT * FROM my_schema_and_table; END LOOP; END; ... I want to get union of each select in loop. one huge joined result. Is this possible? Please help.
Tags (comma-separated)
Save Edits
Cancel