1--TEST-- 2Oracle Database 12c Implicit Result Sets: oci_fetch 3--SKIPIF-- 4<?php 5if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 6$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 7require(dirname(__FILE__).'/skipif.inc'); 8preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 9if (!(isset($matches[0]) && $matches[1] >= 12)) { 10 die("skip expected output only valid when using Oracle Database 12c or greater"); 11} 12preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 13if (!(isset($matches[0]) && $matches[0] >= 12)) { 14 die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 15} 16?> 17--FILE-- 18<?php 19 20require(dirname(__FILE__).'/connect.inc'); 21 22// Initialization 23 24$stmtarray = array( 25 "create or replace procedure imp_res_4_proc as 26 c1 sys_refcursor; 27 begin 28 open c1 for select 1 from dual union select 2 from dual; 29 dbms_sql.return_result (c1); 30 end;" 31); 32 33oci8_test_sql_execute($c, $stmtarray); 34 35// Run Test 36 37echo "Test 1\n"; 38$s = oci_parse($c, "begin imp_res_4_proc(); end;"); 39oci_execute($s); 40oci_fetch($s); // This will fail with ORA-24374 41var_dump(oci_result($s, 1)); 42 43echo "\nTest 2\n"; 44$s = oci_parse($c, "begin imp_res_4_proc(); end;"); 45oci_execute($s); 46$r = oci_fetch_row($s); 47var_dump($r); 48oci_fetch($s); // This will fail with ORA-24374 49var_dump(oci_result($s, 1)); 50$r = oci_fetch_row($s); 51var_dump($r); 52 53// Clean up 54 55$stmtarray = array( 56 "drop procedure imp_res_4_proc", 57); 58 59oci8_test_sql_execute($c, $stmtarray); 60 61?> 62===DONE=== 63<?php exit(0); ?> 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===DONE=== 83