OCI Bound Variables
Posted: Tue Mar 04, 2008 9:06 am
Hello all,
Would anyone happen to know how to use OCI bound variables in a SQL "where in" context?
For example:
Basically I am working with a string $_GET variable which would tell me those IDs, so it might be "1, 3, 4" or "1, 2" or whatever, but I need to be able to select based on those IDs, using bound variables for performance.
In effect, I would try something like this:
Of course, this doesn't work because that list is supposed to be integers. How can I get around this?
Would anyone happen to know how to use OCI bound variables in a SQL "where in" context?
For example:
Code: Select all
select * from employee where id in (1, 2, 3, 4, 5);In effect, I would try something like this:
Code: Select all
$theDB = OCILogon ("employee", "employee", "employee");
$sql = "select * from employee where id in (:list)";
$resource = OCIParse($theDB, $sql);
OCIBindByName($resource, ":list", $_GET['list']);
OCIExecute($resource);