I am trying to execute and get data from my procedure:
Here is how my procedure is defined:
create or replace PROCEDURE SP_GET_MY_DATA(
IN_POP VARCHAR2,
IN_SEG VARCHAR2,
IN_DUR VARCHAR2,
IN_VIEW INTEGER,
IN_PAGE INTEGER,
VIEW_DATA_CUR OUT SYS_REFCURSOR) AS ...
Here is my PHP code for executing and retrieving data from a procedure:
$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = JXYX.com)(PORT = 1521)))(CONNECT_DATA=(SID=DHSJKS)))";
$conn = ocilogon("XXXXXX","XXXXXXXX",$db);
$sql = 'BEGIN SP_GET_MY_DATA(:POP, :SEG, :DUR, :VIEW, :PAGE, :OUTPUT_CUR); END;';
$stmt = oci_parse($conn,$sql);
oci_bind_by_name($stmt,':POP',$pop);
oci_bind_by_name($stmt,':SEG',$seg);
oci_bind_by_name($stmt,':DUR',$dur);
oci_bind_by_name($stmt,':VIEW',$view);
oci_bind_by_name($stmt,':PAGE',$page);
$OUTPUT_CUR = oci_new_cursor($conn);
oci_bind_by_name($stmt,":OUTPUT_CUR", $OUTPUT_CUR, -1, OCI_B_CURSOR);
oci_execute($stmt, OCI_DEFAULT);
while ($data = oci_fetch_assoc($OUTPUT_CUR)) {
print_r($data);
}
But at the same time I get this error:
oci_fetch_assoc (): ORA-24374: the definition is not executed until the extraction or execution and selection. "
I can’t understand what I’m missing. You can help?