1--TEST-- 2Oracle Database 12c Implicit Result Sets: Zero Rows 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_2_proc_a as 27 c1 sys_refcursor; 28 begin 29 open c1 for select * from dual where 1 = 0; 30 dbms_sql.return_result(c1); 31 end;", 32 33 "create or replace procedure imp_res_2_proc_b as 34 c1 sys_refcursor; 35 begin 36 open c1 for select * from dual; 37 dbms_sql.return_result(c1); 38 open c1 for select * from dual where 1 = 0; 39 dbms_sql.return_result(c1); 40 end;", 41 42 "create or replace procedure imp_res_2_proc_c as 43 c1 sys_refcursor; 44 begin 45 open c1 for select * from dual where 1 = 0; 46 dbms_sql.return_result(c1); 47 open c1 for select * from dual; 48 dbms_sql.return_result(c1); 49 end;" 50 51); 52 53oci8_test_sql_execute($c, $stmtarray); 54 55// Run Test 56 57echo "Test 1\n"; 58$s = oci_parse($c, "begin imp_res_2_proc_a(); end;"); 59oci_execute($s); 60while (($row = oci_fetch_row($s)) != false) 61 var_dump($row); 62 63echo "Test 2\n"; 64$s = oci_parse($c, "begin imp_res_2_proc_b(); end;"); 65oci_execute($s); 66while (($row = oci_fetch_row($s)) != false) 67 var_dump($row); 68 69echo "Test 2\n"; 70$s = oci_parse($c, "begin imp_res_2_proc_c(); end;"); 71oci_execute($s); 72while (($row = oci_fetch_row($s)) != false) 73 var_dump($row); 74 75// Clean up 76 77$stmtarray = array( 78 "drop procedure imp_res_2_proc_a", 79 "drop procedure imp_res_2_proc_b", 80 "drop procedure imp_res_2_proc_c" 81); 82 83oci8_test_sql_execute($c, $stmtarray); 84 85?> 86--EXPECT-- 87Test 1 88Test 2 89array(1) { 90 [0]=> 91 string(1) "X" 92} 93Test 2 94array(1) { 95 [0]=> 96 string(1) "X" 97} 98