0

I have a function that I will be running 10-50 times at once:

importsitechanges(33, 209703, 'Store Name', 'Addr', 'city', 'state', 'zip', 'phone')

This function that I made returns the number of changes made as a string.

When I run many of them at once in pgadmin, I only get the return string from the last one:

SELECT * FROM importsitechanges(33, 321344, 'Store Name', 'Addr', 'city', 'state', 'zip', 'phone');
SELECT * FROM importsitechanges(32, 209703, 'Store Name', 'Addr', 'city', 'state', 'zip', 'phone');
...

How can I get the return strings from all of these functions?

2
  • You can try to UNION ALL the single calls. This way you'll get a table, one row for each execution. Commented Nov 11, 2015 at 16:48
  • That works perfectly! Thanks so much! For reference, I now run it as SELECT * FROM importsitechanges(33, 321344, 'Store Name', 'Addr', 'city', 'state', 'zip', 'phone') UNION ALL SELECT * FROM importsitechanges(32, 209703, 'Store Name', 'Addr', 'city', 'state', 'zip', 'phone') UNION ALL ...
    – goldjb
    Commented Nov 11, 2015 at 17:07

1 Answer 1

1

Unfortunately, as you already noticed, pgAdminIII shows only the latest result set. A logical solution could be transforming your 10-50 result sets into one. This can be achieved using UNION ALL:

SELECT * FROM importsitechanges(33, ...)
    UNION ALL
SELECT * FROM importsitechanges(22, ...)
    UNION ALL
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.