Question

I want to create a PREPARED STATEMENT where inputs are some integers whose count is not known. The way I'm trying to do is

PREPARE prep_select_data AS SELECT ARRAY[$1, id], $1, * FROM tbl_data WHERE id = ANY($1);

The error I'm getting is:

ERROR:  op ANY/ALL (array) requires array on right side
LINE 1: ...ELECT ARRAY[$1, id], $1, * FROM tbl_data WHERE id = ANY($1);
                                                             ^

I'm not able to figure out the issue.

Please advise.

Regards,
Mayank

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top