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