String parameters of IBCSQL

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 3
Joined: Thu 27 Sep 2018 14:57

String parameters of IBCSQL

Post by tskom » Thu 27 Sep 2018 18:04

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

Devart Team
Posts: 2830
Joined: Wed 30 Jul 2014 07:16

Re: String parameters of IBCSQL

Post by ViktorV » Fri 28 Sep 2018 12:43

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


Post Reply