Hello I am trying to access a simple function that returns the result of a select query, and when I am accessing it using PHP, it is throwing back a resource(5) at me rather than 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 pretty simple and just retrieves data from a table and returns the few rows that match 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;
Which is fairly simple. Now I am unable to understand why I am getting a resource(5) which is an indication of an error. The actual message I am getting when I var_dump the result is
array(1) { ["SELECTME(:NAME)"]=> resource(5) of type (oci8 statement)