BUG: ODAC doesn't work with unicode string parameters
Posted: Thu 27 Sep 2012 09:08
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 (NLS_CHARACTERSET = AL32UTF8),
Embarcadero® Delphi® XE Version 15.0.3953.35171, ODAC 7.20.0.8, Win32 platform
passing a string with more then 2000 "unicode" chars leads to fault with
ORA-01460 unimplemented or unreasonable conversion requested
will work with "single-byte" characters, e.g. StringOfChar('A', 4000)
the buffer can not be more than 4000 bytes? expected at least 32767!
Embarcadero® Delphi® XE Version 15.0.3953.35171, ODAC 7.20.0.8, Win32 platform
Code: Select all
var OraSession: TOraSession;
var OraQuery: TOraQuery;
begin
OraSession := TOraSession.Create(Application);
with OraSession do begin
ConnectString := 'user/password@database';
Options.Charset := 'AL32UTF8';
Options.UseUnicode := True;
LoginPrompt := False;
Connected := True;
end;
OraQuery := TOraQuery.Create(Application);
with OraQuery do begin
SQL.Text := 'select substr(:P, -1) from DUAL';
// Params[0].AsWideString := StringOfChar('Я', 2001);
// Params[0].AsString := StringOfChar('Я', 2001);
Params[0].DataType := ftWideString;
Params[0].Value := StringOfChar('Я', 2001);
Open;
end;
MessageBox(0, PChar(OraQuery.Fields[0].AsString), 'Result', MB_ICONWARNING or MB_TASKMODAL);
end;
ORA-01460 unimplemented or unreasonable conversion requested
will work with "single-byte" characters, e.g. StringOfChar('A', 4000)
the buffer can not be more than 4000 bytes? expected at least 32767!