1--TEST-- 2Oracle Database 12c Implicit Result Sets: oci_fetch 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_4_proc as 28 c1 sys_refcursor; 29 begin 30 open c1 for select 1 from dual union select 2 from dual; 31 dbms_sql.return_result (c1); 32 end;" 33); 34 35oci8_test_sql_execute($c, $stmtarray); 36 37// Run Test 38 39echo "Test 1\n"; 40$s = oci_parse($c, "begin imp_res_4_proc(); end;"); 41oci_execute($s); 42oci_fetch($s); // This will fail with ORA-24374 43var_dump(oci_result($s, 1)); 44 45echo "\nTest 2\n"; 46$s = oci_parse($c, "begin imp_res_4_proc(); end;"); 47oci_execute($s); 48$r = oci_fetch_row($s); 49var_dump($r); 50oci_fetch($s); // This will fail with ORA-24374 51var_dump(oci_result($s, 1)); 52$r = oci_fetch_row($s); 53var_dump($r); 54 55// Clean up 56 57$stmtarray = array( 58 "drop procedure imp_res_4_proc", 59); 60 61oci8_test_sql_execute($c, $stmtarray); 62 63?> 64--EXPECTF-- 65Test 1 66 67Warning: oci_fetch(): ORA-24374: %s in %simp_res_4.php on line %d 68bool(false) 69 70Test 2 71array(1) { 72 [0]=> 73 string(1) "1" 74} 75 76Warning: oci_fetch(): ORA-24374: %s in %simp_res_4.php on line %d 77bool(false) 78array(1) { 79 [0]=> 80 string(1) "2" 81} 82