Hi,
We have a problem where varchar output parameters are returned with allot of spaces and then some garbage chars at the end. It seems the parameter returned value is padded with spaces+few garbage chars to fill all the size. This does not happen when executing queries that return the same varchar strings.
We are using Delphi 7 and Oracle Server&Client 11.1.0.7 (I remember we had the same issue with Oracle 10.x)
Here is a dump of such a string (each number is the unicode value)
UseUnicode is true (doesn't help setting it to false) and we're not using the direct option.
The NLS_LANG is AMERICAN_AMERICA.UTF8, and the database is of UTF8 as well.
{1502,46,1512,46,1502,46,32,45,32,1502,1506,1512,1499,1514,32,1500,1504,1505,1497,1493,1504,1493,1514,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,65530,65535,30,}
The stored procedure is simple:
procedure Get_Entity_Desc
(
p_edesc out CHAR,
p_etable INTEGER,
p_eentry INTEGER
)as
begin
begin
select
ENTDESC
into
p_edesc
from CTRENTITIES
where
ENTTABLE = p_etable and
ENTENTRY = p_eentry;
exception
when NO_DATA_FOUND THEN
begin
p_edesc:= '';
end;
end;
end;
The code (simplified here):
SP := TOraStoredProc.Create(nil);
SP.Session := DB; // My TOraSession
SP.StoredProcName := 'CTRPKG.Get_Entity_Desc';
SP.params.clear;
p := TOraParam.create(nil);
with p do begin
Name := 'p_edesc';
ParamType := ptOutput;
DataType := ftwideString;
size := 254;
end;
SP.Params.AddParam(p);
p := TOraParam.create(nil);
with p do begin
Name := 'p_etable';
ParamType := ptInput;
DataType := ftwideString;
Value := 4;
end;
SP.Params.AddParam(p);
p := TOraParam.create(nil);
with p do begin
Name := 'p_eentity';
ParamType := ptInput;
DataType := ftwideString;
Value := 997;
end;
SP.Params.AddParam(p);
SP.ExecProc;
widestr = parameters.items[0].Value;
Any suggestions?