Page 1 of 1

String parameters of IBCSQL

Posted: Thu 27 Sep 2018 18:04
by tskom
I downloaded recently IBDAC for Delphi 7 in order to migrate from IBX to IBC and from FB2.5.8 to FB3.0.3
I wrote:

Code: Select all

IbcSql:= TIBCSql.Create(nil);
  with IbcSql do begin
    Connection:= IBCConnection1;
    Transaction:= IBCTransaction1;
    Text:= 'select DOWOD from gm_dowod';
    with TParam(IBCSql.Params.Add) do begin
      ParamType := ptOutPut;
      DataType := ftString;
      Size:= 4;
      Name := 'DOWOD';

    while ExecuteNext do
        Showmessage ( format ('dowod:%s ', [ParamByName(DOWOD').AsString]));

When execution reach ExecuteNext I get an error, what I'm doing wrong ?

Debugger Exception Notification
Project Project1.exe raised exception class EIBCError with message 'Dynamic SQL Error
SQL error code = -303
arithmetic exception, numeric overflow, or string truncation
string right truncation
expected length 0, actual 4'. Process stopped. Use Step or Run to continue.
OK Help

Re: String parameters of IBCSQL

Posted: Fri 28 Sep 2018 12:43
by ViktorV
To solve the problem, you should set the size of the parameter after the parameter is declared. In your example, you should delete line

Code: Select all

  Size: = 4; 
and add line

Code: Select all

  ParamByName ('DOWOD'). Size: = 14;
before line

Code: Select all