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