php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35973 Error ORA-24806 occur when trying to fetch a NCLOB field
Submitted: 2006-01-12 00:56 UTC Modified: 2006-08-09 15:27 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: webmaster at f1-timer dot de Assigned: tony2001 (profile)
Status: Closed Package: OCI8 related
PHP Version: 5CVS-2006-01-14 (snap) OS: Linux, Solaris
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: webmaster at f1-timer dot de
New email:
PHP Version: OS:

 

 [2006-01-12 00:56 UTC] webmaster at f1-timer dot de
Description:
------------
Trying to fetch data from an Oracle 9i Database, the Table has a NCLOB field which cannot be read via PHP, a normal CLOB field however works. The table structure is:

CREATE TABLE NCLOB_TEST
 (
 MYCLOB NCLOB
 );

And it simply contains one line of text with content '12345'

I've tested this behavour with PHP 5.1.1 (Linux and Solaris) and 4.1.1 (only Linux), always give the same result. 


Reproduce code:
---------------
<?php
$query = 'SELECT MYCLOB FROM NCLOB_TEST';
//oci_internal_debug(1);
$sock = OCILogon('SCOTT','TIGER');
$stmt = OCIParse($sock,$query);
OCIExecute($stmt,OCI_DEFAULT);
OCIFetchInto($stmt,$resultarray,OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS);
print_r($resultarray);

// Now try to load the clob with descriptor:

OCIExecute($stmt,OCI_DEFAULT);
OCIFetchInto($stmt,$resultarray,OCI_ASSOC);
print_r($resultarray);
$lobcontent = $resultarray['MYCLOB']->load();
OCIFreeStatement($stmt);

print_r($lobcontent);

OCILogoff($sock);
exit;
?>


Expected result:
----------------
Array
(
    [MYCLOB] => '12345'
)
Array
(
    [MYCLOB] => '12345'
)


Actual result:
--------------
PHP Warning:  ocifetchinto(): OCILobRead: ORA-24806: LOB-Formfehlanpassung
 in /spare/html/private/PHP-Classes/OCI8/bugzilla_php.php on line 8

Warning: ocifetchinto(): OCILobRead: ORA-24806: LOB-Formfehlanpassung
 in /spare/html/private/PHP-Classes/OCI8/bugzilla_php.php on line 8
Array
(
    [MYCLOB] =>
)
Array
(
    [MYCLOB] => OCI-Lob Object
        (
            [descriptor] => Resource id #8
        )

)
PHP Warning:  OCI-Lob::load(): OCILobRead: ORA-24806: LOB-Formfehlanpassung
 in /spare/html/private/PHP-Classes/OCI8/bugzilla_php.php on line 16

Warning: OCI-Lob::load(): OCILobRead: ORA-24806: LOB-Formfehlanpassung
 in /spare/html/private/PHP-Classes/OCI8/bugzilla_php.php on line 16

PS: The Error is in english  "LOB form mismatch" and is described from Oracle as below:

netra:/opt/apache2/conf# oerr ora 24806
24806, 00000, "LOB form mismatch"
// *Cause: When reading from or writing into LOBs, the character set
//         form of the user buffer should be same as that of the LOB.
// *Action: Make sure that the buffer you are using to read or write
//          has the same form as that of the LOB.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-12 10:47 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-01-12 12:24 UTC] webmaster at f1-timer dot de
Tried this with php5.1-200601120930 but still got the error (Warning: ocifetchinto(): ORA-24806: LOB form mismatch in /html/PHP-Classes/OCI8/nclob.php on line 14)

However I found a workaround to continue developing, I've changed the query from

"SELECT MY_NCLOB_FIELD FROM MY_TABLE" 

to 

"SELECT TO_CHAR(MY_NCLOB_FIELD) AS NC FROM MY_TABLE"

which works fine, same when using the TO_NCHAR() function. Only when the plain NCLOB field is selected the error occures.
 [2006-01-12 23:03 UTC] sniper@php.net
Assigned to the maintainer.
 [2006-08-09 12:45 UTC] tony2001@php.net
Heh, interesting.. OCIAttrGet() says its SQLT_CLOB, not SQLT_NCLOB, thus I don't see any chance to know what exactly to pass as the last parameter to OCILobRead().
 [2006-08-09 15:27 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC