php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33564 Strange behaviour passing long string to TRANSLATE in oracle
Submitted: 2005-07-04 16:18 UTC Modified: 2005-09-16 01:00 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: daniel at bitarts dot com Assigned: tony2001 (profile)
Status: No Feedback Package: OCI8 related
PHP Version: 5.0.4 OS: 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: daniel at bitarts dot com
New email:
PHP Version: OS:

 

 [2005-07-04 16:18 UTC] daniel at bitarts dot com
Description:
------------
Trying to insert data into an NCLOB field. I can do this by using a TRANSLATE in my sql, and binding variable with the OCIBindByName functions. However, when I pass a certain amount of characters, the update fails with this (incorrect) error:
Warning: ociexecute() [function.ociexecute]: OCIStmtExecute: ORA-12703: this character set conversion is not supported 

That amount of characters seems to be 2000. In the code below, if you change this line
$data = str_pad($data, 2001, "a");   
to
$data = str_pad($data, 2000, "a");

It works fine. It's only when you try to insert more than 2000 characters you get this odd behaviour.

Thank you.
Daniel   

Reproduce code:
---------------
$data = str_pad($data, 2001, "a");    
						 
$lob = OCINewDescriptor($conn, OCI_D_LOB); 
$stmt = OCIParse($conn,"UPDATE TEST 
                        SET NCLOB_TEST = TRANSLATE(:NCLOB_TEST USING NCHAR_CS) 
                        WHERE ID='1'"); 

OCIBindByName($stmt, ':NCLOB_TEST', &$lob, -1, OCI_B_CLOB); 
$lob->WriteTemporary($data); 
OCIExecute($stmt, OCI_DEFAULT); 
$lob->close(); 
$lob->free(); 
OCICommit($conn);

Expected result:
----------------
The NCLOB data field fills with 2001 "a" characters

Actual result:
--------------
error message:
Warning: ociexecute() [function.ociexecute]: OCIStmtExecute: ORA-12703: this character set conversion is not supported 

Nothing added to database.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-04 16:20 UTC] daniel at bitarts dot com
I am using Oracle 9i
 [2005-07-04 22:24 UTC] tony2001@php.net
And what if you try to do the same with SQLPlus?
Do the same query work for you?
 [2005-07-05 11:23 UTC] daniel at bitarts dot com
Same things happens there too, when I add lots of characters. Seems to be a bug in oracle?
 [2005-07-05 11:35 UTC] tony2001@php.net
Or some kind of your mistake, I'm not sure how to classify it. 
So it doesn't look like PHP-only problem and I'm closing this report as bogus. Feel free to reopen it if/when you have more info.
 [2005-07-05 16:53 UTC] daniel at bitarts dot com
I had made a mistake, TRANSLATE only works for NVARCHAR's etc and anything less than 2000 characaters.

What I should be using is TO_NCHAR.  This works fine in sql:
UPDATE TEST 
SET NCLOB_BACKUP = TO_NCLOB(:NCLOB_BACKUP) 
WHERE ID='4

However, running this through php causes php to lock up:

$data = "TEst2";
						 
$lob = OCINewDescriptor($conn, OCI_D_LOB); 
$stmt = OCIParse($conn,"UPDATE TEST 						SET NCLOB_BACKUP = TO_NCLOB(:NCLOB_BACKUP) 						                WHERE ID='4'"); 

OCIBindByName($stmt, ':NCLOB_BACKUP', &$lob, -1, OCI_B_CLOB); 
$lob->WriteTemporary($data); 
OCIExecute($stmt, OCI_DEFAULT); 
$lob->close(); 
$lob->free(); 
OCICommit($conn);

I'm not too sure if it is an oracle bug anymore, or if it is, php should respond to it better?

Thanks
 [2005-09-08 11:52 UTC] tony2001@php.net
Please try OCI8 v.1.1, which is available in CVS HEAD and PECL (use `pear install oci8-beta` to install it).
 [2005-09-16 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-03-16 18:12 UTC] phpnet at rosenthaltechnologies dot com
I'm getting the same error with oci9... (when I try to save an nclob it locks up).  what is the status of nclob support in oci9?

Best,
Brian
 [2008-06-03 10:57 UTC] ait_ajkdak at yahoo dot com
When using software products with graphical interfaces, we frequently focus so much on the details of how to use the interface that we forget about the general concepts that allow us to understand and use the software effectively. This is particularly true of a powerful database product like Microsoft Access. Novice, and sometimes even experienced, programmers are so concerned with how something is done in Access that they often lose sight of the general principles that underlie their database applications. Access Database Design and Programming takes you behind the details of the Access interface, focusing on the general knowledge necessary for Access power users or developers to create effective database applications.1212121272381723461278934629378462937429329341
When using software products with graphical interfaces, we frequently focus so much on the details of how to use the interface that we forget about the general concepts that allow us to understand and use the software effectively. This is particularly true of a powerful database product like Microsoft Access. Novice, and sometimes even experienced, programmers are so concerned with how something is done in Access that they often lose sight of the general principles that underlie their database applications. Access Database Design and Programming takes you behind the details of the Access interface, focusing on the general knowledge necessary for Access power users or developers to create effective database applications.1212121272381723461278934629378462937429329341
When using software products with graphical interfaces, we frequently focus so much on the details of how to use the interface that we forget about the general concepts that allow us to understand and use the software effectively. This is particularly true of a powerful database product like Microsoft Access. Novice, and sometimes even experienced, programmers are so concerned with how something is done in Access that they often lose sight of the general principles that underlie their database applications. Access Database Design and Programming takes you behind the details of the Access interface, focusing on the general knowledge necessary for Access power users or developers to create effective database applications.1212121272381723461278934629378462937429329341
When using software products with graphical interfaces, we frequently focus so much on the details of how to use the interface that we forget about the general concepts that allow us to understand and use the software effectively. This is particularly true of a powerful database product like Microsoft Access. Novice, and sometimes even experienced, programmers are so concerned with how something is done in Access that they often lose sight of the general principles that underlie their database applications. Access Database Design and Programming takes you behind the details of the Access interface, focusing on the general knowledge necessary for Access power users or developers to create effect
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 14:01:30 2024 UTC