Subject | PSQL: Support for variables in ?? |
---|---|
Author | rbd523 |
Post date | 2004-07-13T06:14:36Z |
First off, this list has been very helpful!
My current inquiry revolves around the following type of query in a
PSQL stored procedure:
UPDATE surveyquestion SET num_opt5 = num_opt5 + 1
WHERE memberid = :memberid
AND surveyid = :surveyid
AND idnum IN :opt5_answers;
(The part of importance is the "IN :opt5_answers" part. Basically,
what I am wanting to do is pass a string in the form of "(123, 456,
789 ...)" in to the stored proc as opt5_answers, and use that in my
IN search condition. But, of course the parser doesn't like that
usage and is giving me an error about it. But is this or anything
functionally equivalent to it possible? As the IDs to modify are
composed elsewhere, that list of IDs is not stored in the database
anywhere, so I can't use a select statement there....
Thanks for any help,
Robby
My current inquiry revolves around the following type of query in a
PSQL stored procedure:
UPDATE surveyquestion SET num_opt5 = num_opt5 + 1
WHERE memberid = :memberid
AND surveyid = :surveyid
AND idnum IN :opt5_answers;
(The part of importance is the "IN :opt5_answers" part. Basically,
what I am wanting to do is pass a string in the form of "(123, 456,
789 ...)" in to the stored proc as opt5_answers, and use that in my
IN search condition. But, of course the parser doesn't like that
usage and is giving me an error about it. But is this or anything
functionally equivalent to it possible? As the IDs to modify are
composed elsewhere, that list of IDs is not stored in the database
anywhere, so I can't use a select statement there....
Thanks for any help,
Robby