1--TEST-- 2Oracle Database 12c Implicit Result Sets: oci_free_statement #1 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 8require(__DIR__.'/skipif.inc'); 9preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 10if (!(isset($matches[0]) && $matches[1] >= 12)) { 11 die("skip expected output only valid when using Oracle Database 12c or greater"); 12} 13preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 14if (!(isset($matches[0]) && $matches[0] >= 12)) { 15 die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 16} 17?> 18--FILE-- 19<?php 20 21require(__DIR__.'/connect.inc'); 22 23// Initialization 24 25$stmtarray = array( 26 "create or replace procedure imp_res_close_proc as 27 c1 sys_refcursor; 28 begin 29 open c1 for select 1 from dual union all select 2 from dual order by 1; 30 dbms_sql.return_result(c1); 31 open c1 for select 3 from dual union all select 4 from dual order by 1; 32 dbms_sql.return_result(c1); 33 open c1 for select 5 from dual union all select 6 from dual order by 1; 34 dbms_sql.return_result(c1); 35 end;" 36); 37 38oci8_test_sql_execute($c, $stmtarray); 39 40// Run Test 41 42echo "Test 1\n"; 43$s = oci_parse($c, "begin imp_res_close_proc(); end;"); 44oci_execute($s); 45 46try { 47 while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { 48 foreach ($row as $item) { 49 echo " ".$item; 50 } 51 echo "\n"; 52 oci_free_statement($s); // Free the implicit result handle 53 } 54} catch(\TypeError $exception) { 55 var_dump($exception->getMessage()); 56} 57 58// Clean up 59 60$stmtarray = array( 61 "drop procedure imp_res_close_proc" 62); 63 64oci8_test_sql_execute($c, $stmtarray); 65 66?> 67--EXPECTF-- 68Test 1 69 1 70string(%d) "oci_fetch_array(): supplied resource is not a valid oci8 statement resource" 71