Home » Open Source » Programming Interfaces » PHP insert or update nvarchar2 (PHP 5.2.16, Oracle 9i, OCI8 from Instant Client 10.2.x)
PHP insert or update nvarchar2 [message #542604] |
Wed, 08 February 2012 03:30 |
|
stephan.wild
Messages: 4 Registered: February 2012 Location: Regensburg - Bavaria - Ge...
|
Junior Member |
|
|
Hello together,
I have a little problem with inserting / updateing data from PHP to Oracle. My Oracle charset setup is:
NLS_CHARACTERSET=WE8MSWIN1252 and NLS_NCHAR_CHARACTERSET=AL16UTF16
Now I want to put in some cyrillic signs. My SQL-statement looks like:
update table set
field_1 = utl_raw.cast_to_nvarchar2(utl_raw.convert('пуищ','AMERICAN_AMERICA.AL16UTF16','AMERICAN_AMERICA.AL32UTF8')),
field_2 = utl_raw.cast_to_nvarchar2(utl_raw.convert('','AMERICAN_AMERICA.AL16UTF16','AMERICAN_AMERICA.AL32UTF8'))
where rtrim(field_3,' ') = '1014006981' and langcode = 'RU';
My error message is:
SQL-Fehler: ORA-01465: invalid hex number
01465. 00000 - "invalid hex number"
*Cause:
*Action:
I hope someone of has the answer.
Thank you very much
Stephan
|
|
|
Re: PHP insert or update nvarchar2 [message #542622 is a reply to message #542604] |
Wed, 08 February 2012 04:06 |
|
Michel Cadot
Messages: 68728 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
1/
Quote:field_2 = utl_raw.cast_to_nvarchar2(utl_raw.convert('','AMERICAN_AMERICA.AL16UTF16','AMERICAN_AMERICA.AL32UTF8'))
NULL (empty string) is the same NULL in any character set, so just replace it by "field_2 = NULL".
2/
utl_raw.convert takes a RAW data as first parameter not a string.
You have to first apply utl_raw.cast_to_raw but I'm not sure it will.
Why don't you just use "field_1 = N'пуищ'" (if field1 is of NVARCHAR2 datatype, if not please post the datatype of each column)?
Regards
Michel
[Updated on: Wed, 08 February 2012 04:07] Report message to a moderator
|
|
|
|
|
Re: PHP insert or update nvarchar2 [message #542677 is a reply to message #542642] |
Wed, 08 February 2012 09:28 |
|
stephan.wild
Messages: 4 Registered: February 2012 Location: Regensburg - Bavaria - Ge...
|
Junior Member |
|
|
Hi,
my environment for NLS_LANG is set to "AMERICAN_AMERICA.AL32UTF8".
When I dump this special field I get:
Typ=1 Len=8: 0,191,0,191,0,191,0,191
Another field with cyrillic signs I get:
Typ=1 Len=60: 4,58,4,62,4,59,4,76,4,70,4,62,0,32,4,68,4,62,4,64,4,60,4,75,0,32,0,86,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32
I don't know what this data means.
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Dec 21 10:11:45 CST 2024
|