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