xref: /PHP-8.3/ext/oci8/tests/bug35973.phpt (revision a53e5617)
1--TEST--
2Bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
9require __DIR__.'/skipif.inc';
10?>
11--FILE--
12<?php
13
14require __DIR__.'/connect.inc';
15
16$s1 = oci_parse($c, "drop table test_nclob");
17@oci_execute($s1);
18
19$s2 = oci_parse($c, "create table test_nclob (nc NCLOB)");
20oci_execute($s2);
21
22$s3 = oci_parse($c, "insert into test_nclob (nc) values ('12345data')");
23oci_execute($s3);
24
25$s3 = oci_parse($c, "select * from test_nclob");
26oci_execute($s3);
27
28var_dump($data = oci_fetch_assoc($s3));
29$d = $data['NC'];
30
31var_dump($d->read(5));
32var_dump($d->read(4));
33
34$s1 = oci_parse($c, "drop table test_nclob");
35@oci_execute($s1);
36
37echo "Done\n";
38?>
39--EXPECTF--
40array(1) {
41  ["NC"]=>
42  object(OCILob)#%d (1) {
43    ["descriptor"]=>
44    resource(%d) of type (oci8 descriptor)
45  }
46}
47string(%d) "%s5"
48string(%d) "%sa"
49Done
50