Hello, I'm trying to access a simple function that returns the result of a select query, and when I access it using PHP, it returns to me (5) the resource (not the result).
$connect = oci_connect('tiger','scott','host/user');
if(!$connect){
$e = oci_error();
trigger_error(htmlentities($e['message'],ENT_QUOTES),E_USER_ERROR);
}
$qu = oci_parse($connect, 'select selectMe(:name) from dual');
$name = (string)'test1';
oci_bind_by_name($qu,":name",$name);
oci_execute($qu);
$row = oci_fetch_assoc($qu);
var_dump($row);
The selectMe function is quite simple and simply retrieves data from the table and returns a few rows matching the condition.
CREATE OR REPLACE FUNCTION selectMe( temp_name varchar2(100) )
return SYS_REFCURSOR is my_ret SYS_REFCURSOR;
BEGIN
open my_ret
FOR select myTab_ID, myTab_NAME, myTab_AGE, myTab_SCORE
from myTab
where trim(myTab_name) = temp_name;
RETURN my_ret;
END;
It is pretty simple. Now I can not understand why I get the resource (5), which is a sign of error. The actual message that I get when I var_dump the result
array (1) {["SELECTME (: NAME)"] => resource (5) of type (oci8 instruction)
macha source
share