Page 1 of 1

Oracle Package Wizard and Unicode

Posted: Sun 21 Feb 2010 23:31
by Lu53
In a package, I have this function:

Code: Select all

Function Test(Divisor In Integer,
                SomeText In Nvarchar2) return Nvarchar2 
As
 RetVal Nvarchar2(100);
Begin
 RetVal := SomeText;
 Return RetVal;
End;
The "Oracle Package Wizard" produces this wrapper:

Code: Select all

function TFdsSo.Test(const Divisor: double; const Sometext: WideString): WideString;
var
  ResultParam, DivisorParam, SometextParam: TOraParam;
begin
  BeginExecPLSQL;
  try
    ResultParam := AddParam('RESULT', ftWideString, ptOutput);
    DivisorParam := AddParam('DIVISOR', ftFloat, ptInput);
    DivisorParam.AsFloat := Divisor;
    SometextParam := AddParam('SOMETEXT', ftWideString, ptInput);
    SometextParam.AsWideString := Sometext;
    ExecProc('TEST');
    Result := ResultParam.AsWideString;
  finally
    EndExecPLSQL;
  end;
end;
When I call:

Code: Select all

  Var Res : WideString; // or String, doesn't matter
  Res := Test(1,'Создание пиктограммы');
Then on return, Res contains garbage (i.e. '???????? ???????') rather than the russian characters. Both OraSession.Options.UseUnicode and OCIUnicode are True.

Now, if I do the same with a TOraStoredProc, all works as expected. So, what is wrong with the auto generated wrapper?

Using registered version of ODAC 6.90.0.55 with Delphi 2009.

Thanks, Lu

Posted: Wed 24 Feb 2010 11:51
by Challenger
Please specify the value of the National property of the SOMETEXT parameter when you are using the TOraStoredProc component.

Posted: Wed 24 Feb 2010 14:43
by Lu53
Challenger wrote:Please specify the value of the National property of the SOMETEXT parameter when you are using the TOraStoredProc component.
I wasn't aware of a National property so I did not use it explicitly by now. It seems to default to true, because when I now explicitly set it to false for testing then the result is the '????' garbage again. For testing, I use the following code:

Result ok

Code: Select all

 
Var Res : String; // Implicitly Unicode in D2009
 SP1.ParamByName('DIVISOR').AsInteger := 10;
 SP1.ParamByName('SOMETEXT').National := True;
 SP1.ParamByName('SOMETEXT').AsWideString := 'Вход в систему';
 SP1.Execute;
 Res := SP1.ParamByName('RESULT').AsWideString;


Result garbage

Code: Select all

 
 ...
 SP1.ParamByName('SOMETEXT').National := False;
 SP1.ParamByName('SOMETEXT').AsWideString := 'Вход в систему';
 SP1.Execute;
 Res := SP1.ParamByName('RESULT').AsWideString;
Thanks, Lu

Posted: Thu 25 Feb 2010 11:19
by Challenger
We have added support of Natinal parameter to Package Wizard.