Im new in Oracle DB and I am having hard time using 'IN' operator in Oracle DB.
Im using 'IN' operator from a string in PHP.
This is how I bind on PHP
$var1_in = "Santos,Reyes";
oci_bind_by_name($stid, ':cursor_out', $out_cursor, -1, OCI_B_CURSOR);
oci_bind_by_name($stid, ':var1_in', $var1_in);
This my query in DB
PROCEDURE someFunction
(
CURSOR_OUT OUT REFCURSOR,
VAR1_IN IN VARCHAR2
) AS
BEGIN
OPEN CURSOR_OUT FOR
SELECT LAST_NAME, SALARY, EMPNO
FROM EMPLOYEES
WHERE EMP_LNAME IN (VAR1_IN);
END someFunction;
Thanks in advance!
you should use the literal in PHP
to work with IN
clause like below
$var1_in = "'Santos','Reyes'";
I don't know whether the single quote in double quote works, but in oracle the varchar2
should be in single literal