So, i need to use php in order to extract some information out of my database through a procedure.
There's a problem in my code and i can't get to it.
I have the following procedure:
CREATE OR REPLACE PROCEDURE example(
input IN varchar2,
p1 OUT SYS_REFCURSOR)
AS
BEGIN
OPEN p1 FOR
SELECT title
FROM book
WHERE gen LIKE '_' + input + '%'
ORDER BY gen;
END;
and here is my php code:
$curs = oci_new_cursor($con);
$stmt = oci_parse($con, "begin example(:input, :data); end;");
$word = 'S';
oci_bind_by_name($stmt, "input", $word);
oci_bind_by_name($stmt, "data", $curs, -1, OCI_B_CURSOR);
oci_execute($stmt);
oci_execute($curs);
$nr_rows = oci_fetch_all($curs, $data, null, null, OCI_FETCHSTATEMENT_BY_COLUMN);
I think the code is well written but for some odd reasons i get this error
"Warning: oci_fetch_all(): ORA-01722: invalid number in C:.."
I've tried to use cast in the procedure but the error still occures.
The select that i'm looking for is the following:
SELECT title
FROM book
WHERE gen LIKE '_S%'
ORDER BY gen;
Any ideas?