i have the following small procedure in my database:
CREATE OR REPLACE PROCEDURE "MIRROR" (
IN_VAL IN VARCHAR2 ,
OUT_VAL OUT VARCHAR2
)
IS
BEGIN
OUT_VAL := IN_VAL;
END;
/
In my application i use an TSQLStoredproc to feed this procedure with data. Used a TEdit for the input and tLabel for the output.
Only if the in characters are from codepage "1252" the in and out values are the same.
If the in values are unicode characters not found in codepage 1252 only
Question marks are displayed.
For in_val and out_val datatype ftstring was used.
When changing both datatypes to ftwidestring. The displayed characters
doesn't have any relationship to the input characters.
What is wrong
Behavior of TSQLStoredProc together with Unicode
Hello
To use the Unicode characters in your parameters you should set the UseUnicode parameter to True. You can find more detailed information about this in the dbExress Oracle driver documentation (the Readme.html file).
Also you should keep in mind that in this case Unicode will be used for transferring data between your application and Oracle client. But if you use the VARCHAR2 data type then Oracle client converts Unicode characters to Oracle server charset and some information can be lost. If you want to use the Unicode parameters then you should use the NVARCHAR2 data type:
To use the Unicode characters in your parameters you should set the UseUnicode parameter to True. You can find more detailed information about this in the dbExress Oracle driver documentation (the Readme.html file).
Also you should keep in mind that in this case Unicode will be used for transferring data between your application and Oracle client. But if you use the VARCHAR2 data type then Oracle client converts Unicode characters to Oracle server charset and some information can be lost. If you want to use the Unicode parameters then you should use the NVARCHAR2 data type:
Code: Select all
CREATE OR REPLACE PROCEDURE "MIRROR" (
IN_VAL IN NVARCHAR2 ,
OUT_VAL OUT NVARCHAR2
)
IS
BEGIN
OUT_VAL := IN_VAL;
END;
/
Hello,
I've changed the database procedure as you have suggested.
The result is the same as before.
The internal character set of my database is AL32UTF8.
The connection is opened with the parameter useunicode=true.
the parameters are set/read with the methode
parambyname ('in_val').aswidestring resp.
parambyname ('out_val').aswidestring
I've changed the database procedure as you have suggested.
The result is the same as before.
The internal character set of my database is AL32UTF8.
The connection is opened with the parameter useunicode=true.
the parameters are set/read with the methode
parambyname ('in_val').aswidestring resp.
parambyname ('out_val').aswidestring