Return result from a Function with a db package

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
nclark
Posts: 19
Joined: Wed 10 Oct 2007 11:45
Location: Norway

Return result from a Function with a db package

Post by nclark » Fri 25 Jan 2008 14:20

Hi

I am getting an ORA-6502 (numeric or value error - character buffer string too small) whenever I get a non zero length result from a function call.

I am sure(?) that it is how my RESULT_PARAM is defined but have tried various options for some time.

In addition to helping me (as I am very new to Delphi ..) can you please explain how I can find these answers out myself. The documention that I read assumes zero Delphi knowledge or otherwise a Masters degree!

Anyway, the function is called using the following and it is the EXECPROC taht is complaining :
Function Tgedcom_iface2.put_gedcom2(
const AP_LOGIN_ID: string;
const len_login_id:integer;
const AP_FAMX: string;
const len_famx: integer
): string;
var
RESULT_PARAM,
AP_LOGIN_ID_PARAM,
AP_FAMX_PARAM
: TOraParam;
begin
BeginExecPLSQL;
try
AP_LOGIN_ID_PARAM := AddParam('P_LOGIN_ID', ftString, ptInput);
AP_LOGIN_ID_PARAM.Size := len_login_id;
AP_LOGIN_ID_PARAM.AsString := AP_LOGIN_ID;

AP_FAMX_PARAM := AddParam('P_FAMX', ftString, ptInput);
AP_FAMX_PARAM.Size := len_famx;
AP_FAMX_PARAM.AsString := AP_FAMX;

RESULT_PARAM := AddParam('RESULT', ftUnknown, ptOutput);
RESULT_PARAM.Size := 200; // check

ExecProc('PUT_GEDCOM2');
Result := frmGedcom.OraStoredProc1.ParamByName('RESULT').AsString;
finally
EndExecPLSQL;
end;
end;

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 29 Jan 2008 09:13

Please specify whether you have generated this code with Package Wizard from the last ODAC build (6.25.1.13). In the last build we have fixed the bug in Package Wizard with incorrect data types for parameters. I see that Result parameter has ftUnknown type in your code. That is incorrect. Try to regenerate the unit for your package with last ODAC build.

You also can use TOraStoredProc component to call a procedure from the package. This is the simplest and most widely used way.

Post Reply