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