1--TEST--
2Oracle Database 12c Implicit Result Sets: using SQL 'CALL'
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_call_err_proc as
26      c1 sys_refcursor;
27    begin
28      open c1 for select * from dual;
29      dbms_sql.return_result(c1);
30      open c1 for select * from dual;
31      dbms_sql.return_result (c1);
32    end;");
33
34oci8_test_sql_execute($c, $stmtarray);
35
36// Run Test
37
38echo "Test 1\n";
39
40$s = oci_parse($c, "call imp_res_call_err_proc()");
41oci_execute($s);
42
43// Clean up
44
45$stmtarray = array(
46    "drop procedure imp_res_call_err_proc"
47);
48
49oci8_test_sql_execute($c, $stmtarray);
50
51?>
52===DONE===
53<?php exit(0); ?>
54--EXPECTF--
55Test 1
56
57Warning: oci_execute(): ORA-29478: %s
58ORA-06512: at "SYS.DBMS_SQL", line %d
59ORA-06512: at "SYS.DBMS_SQL", line %d
60ORA-06512: at "%s.IMP_RES_CALL_ERR_PROC", line %d in %simp_res_call_error.php on line %d
61===DONE===
62