ORA-01722: invalid number using IN
<p>I saw <a href="https://stackoverflow.com/questions/12549029/sql-error-ora-01722-invalid-number">this question</a> so now I have an idea as to what the problem is.</p>

<p>Somehow I don't know the solution though.</p>

<p>I'm doing this query:</p>

<pre><code>SELECT *
FROM my_table t
WHERE t.category_id = :category_id
AND t.group_id IN (:group_ids)
</code></pre>

<p>With the above query I'm binding these variables:</p>

<pre><code>oci_bind_by_name($stmt, ":category_id", $category_id, OCI_B_INT);
oci_bind_by_name($stmt, ":group_ids", $group_ids);
</code></pre>

<p>Notice that for the <code>group_id</code> column I need to check whether the value is in the list provided like so:</p>

<pre><code>$group_ids = implode(", " array_filter($list_of_groups)); // could be 0 or 12345 or 12345, 67890
</code></pre>

<h3>Note</h3>

<p>I didn't use <code>OCI_B_INT</code> when I bound the <code>$group_ids</code> to <code>:group_ids</code> because I'm using <code>IN</code>.</p>

<h3>Additional Information</h3>

<p>So somehow the stuff works when the value of <code>$group_ids</code> is just one ID but if I have multiple IDs separated by commas then the query throws the error.</p>