I saw this question so now I have an idea as to what the problem is.
Somehow I don't know the solution though.
I'm doing this query:
SELECT *
FROM my_table t
WHERE t.category_id = :category_id
AND t.group_id IN (:group_ids)
With the above query I'm binding these variables:
oci_bind_by_name($stmt, ":category_id", $category_id, OCI_B_INT);
oci_bind_by_name($stmt, ":group_ids", $group_ids);
Notice that for the group_id
column I need to check whether the value is in the list provided like so:
$group_ids = implode(", " array_filter($list_of_groups)); // could be 0 or 12345 or 12345, 67890
Note
I didn't use OCI_B_INT
when I bound the $group_ids
to :group_ids
because I'm using IN
.
Additional Information
So somehow the stuff works when the value of $group_ids
is just one ID but if I have multiple IDs separated by commas then the query throws the error.