UniDAC with Oracle Unicode Problem

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
rhettp
Posts: 25
Joined: Tue 15 Aug 2006 01:25

UniDAC with Oracle Unicode Problem

Post by rhettp » Thu 23 Dec 2010 23:44

I am trying to use UniDAC to update a Unicode Oracle database (character set: AL32UTF8

I try these 3 and nothing will update a NVARCHAR2 field correctly - it shows as ????? after the post.

UPDATE UNICODETEST SET FULL_NAME = 'ΕΖΗΘΙΚΛΜΝΞΟβγδεζηθικλμ' WHERE KEY_FIELD = 'RECORD1'

or this: UPDATE UNICODETEST SET FULL_NAME = UNISTR('ΕΖΗΘΙΚΛΜΝΞΟβγδεζηθικλμ') WHERE KEY_FIELD = 'RECORD1'

or this: UPDATE UNICODETEST SET FULL_NAME = N'ΕΖΗΘΙΚΛΜΝΞΟβγδεζηθικλμ' WHERE KEY_FIELD = 'RECORD1'

Any ideas? This problem does not occur with ODAC.

Thanks,

Rhett

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Fri 24 Dec 2010 07:55

Hello,

To resolve the problem you should set the OraCallUni.OCIUnicode variable to true ( in this case you need to include the OraCallUni unit in the uses section), or use parameters in the query like

UPDATE UNICODETEST
SET FULL_NAME = :full_name
WHERE KEY_FIELD = 'RECORD1'

UniQuery.ParamByNAme('full_name').AsWideString:= 'ΕΖΗΘΙΚΛΜΝΞΟβγδεζηθικλμ';

a more correct variant is use is use the query with the parameters.

rhettp
Posts: 25
Joined: Tue 15 Aug 2006 01:25

Post by rhettp » Fri 24 Dec 2010 16:36

Thanks for the help. I am actually already setting OraCalUni.OCIUnicode to True. I only had OraCall unit in my uses though. So I added OraCallUni but still had the same results.

Params have been working for me in testing, but I can't just switch this older code to Params. It's hundreds of thousands of lines of older code that uses constants.

Any other ideas?

Thanks,

Rhett

rhettp
Posts: 25
Joined: Tue 15 Aug 2006 01:25

Post by rhettp » Fri 24 Dec 2010 17:05

Ah...! I went back and checked again and realized that I was setting OraCal.OCIUnicode - not OraCalUni.OCIUnicode to True. That did the trick! Thanks very much.

- Rhett

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 27 Dec 2010 07:01

Hello,

It is good to see that this problem was solved. If any other questions come up, please contact us.

Post Reply