Good morning,
I have a function argument blah of type text containing something like
33,44,55,66
. Can I cast it in some way to use it in an IN clause as integers like
UPDATE foo SET x = y WHERE id IN ( blah );
or need I revert to dynamic SQL (EXECUTE...) ?
Thanks, Axel
---
On 26 Oct 2010, at 9:07, venkat wrote:
Dear All,
I want to update multiple row in single query.I am trying for below query.I
am getting error as
ERROR: more than one row returned by a subquery used as an expression
SQL state: 21000
You're probably looking for UPDATE table FROM
If you do not understand what you are doing, it might be a good idea to find
someone in your organization who understands SQL.
You were given the suggestion UPDATE table SET column list FROM from list
... which is documented here:
http://www.postgresql.org/docs/9.0/interactive/sql-update.html
Hey Axel,
How about this solution:
UPDATE foo SET x = y WHERE ANY(string_to_array(blah, ',')) = id;
?
2010/10/25 Axel Rau axel@chaos1.de
Good morning,
I have a function argument blah of type text containing something like
33,44,55,66
. Can I cast it in some way to use it in an IN
Ooops, sorry
UPDATE foo SET x = y WHERE id = ANY(string_to_array(blah, ',')::integer[]);
2010/10/29 Dmitriy Igrishin dmit...@gmail.com
Hey Axel,
How about this solution:
UPDATE foo SET x = y WHERE ANY(string_to_array(blah, ',')) = id;
?
2010/10/25 Axel Rau axel@chaos1.de
Good
rawi only4...@web.de writes:
The Error was caused because I used UNION in place of UNION ALL.
I still don't understand why the ARRAY (path) could not be grouped...
Yeah, it's an unimplemented feature --- there's no hashing support for
arrays. I hope to get that done for 8.5. In the