>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of James Sharrett Sent: Saturday, September 08, 2012 6:24 PM To: pgsql-sql@postgresql.org Subject: [SQL] returning values to variables from dynamic SQL
I have a PG function ( using plpgsql) that calls a number of sub functions also in plpgsql. I have two main problems that seem to be variations on the same theme of running dynamic SQL from a variable with the EXECUTE statement and returning the results back to a variable defined in the calling function. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Please read: http://www.postgresql.org/docs/9.0/interactive/plpgsql-statements.html#PLPGS QL-STATEMENTS-EXECUTING-DYN Basically when you use "EXECUTE" you do not embed the "INTO" as part of the SQL query but rather INTO becomes a modifier of the EXECUTE itself: EXECUTE 'some query' INTO {variables} David J. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql