Dynamic SQL Error SQL error code =-303 internal error

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
michaelJ
Posts: 30
Joined: Thu 13 Jan 2011 16:11

Dynamic SQL Error SQL error code =-303 internal error

Post by michaelJ » Tue 30 Aug 2011 10:29

Hello,

I've got the error
'Dynamic SQL Error SQL error code =-303 internal error'
when I do the following:


Code: Select all

if not IBCTRANSACTION.Active then IBCTRANSACTION.StartTransaction;
DM.SP_TMP.SQL.Text:='update AUSLIEF set INFOMEMO=:INFOMEMO where ID7_ASL=:ID';

IBCQuery.ParamByName('INFOMEMO').AsMemo:='This ist a test'; //TextBlob
IBCQuery.ParamByName('ID').value:=12345;

IBCQuery.Execute;
IBCTRANSACTION.CommitRetaining;


if not IBCTRANSACTION.Active then IBCTRANSACTION.StartTransaction; 
SQL.Text:='update ORDER_MEMO set MEMOTEXT=:INFOMEMO where ID_CLT=:ID_CLT AND ID_MNF=:ID_MNF AND SAISON=:SAISON';


with DM.SP_TMP do
IBCQuery.ParamByName('INFOMEMO').AsString:=MemoText;   //VarChar(511)
IBCQuery.ParamByName('ID_CLT').AsInteger:=ID_CLT;
IBCQuery.ParamByName('ID_MNF').AsInteger:=ID_MNF;
IBCQuery.ParamByName('SAISON').AsString:=SAISON;

IBCQuery.Execute;  //Here ERROR !!!!!
IBCTRANSACTION.CommitRetaining;

Version: V3.60.0.24

Thank you for helping!

Michael

PS:
When I rename the parameter 'INFOMEMO' to 'INFOMEMOX' in the second call it works.

AndreyZ

Post by AndreyZ » Tue 30 Aug 2011 12:49

Hello,

To solve the problem, you should clear parameters of the TIBCQuery component between two executions. Here is an example:

Code: Select all

if not IBCTRANSACTION.Active then IBCTRANSACTION.StartTransaction;
IBCQuery.SQL.Text := 'update AUSLIEF set INFOMEMO=:INFOMEMO where ID7_ASL=:ID';
IBCQuery.ParamByName('INFOMEMO').AsMemo := 'This ist a test'; //TextBlob 
IBCQuery.ParamByName('ID').value := 12345;
IBCQuery.Execute;
IBCTRANSACTION.CommitRetaining;

if not IBCTRANSACTION.Active then IBCTRANSACTION.StartTransaction;
IBCQuery.Params.Clear;
IBCQuery.SQL.Text := 'update ORDER_MEMO set MEMOTEXT=:INFOMEMO where ID_CLT=:ID_CLT AND ID_MNF=:ID_MNF AND SAISON=:SAISON';
IBCQuery.ParamByName('INFOMEMO').AsString:=MemoText;   //VarChar(511) 
IBCQuery.ParamByName('ID_CLT').AsInteger:=ID_CLT; 
IBCQuery.ParamByName('ID_MNF').AsInteger:=ID_MNF; 
IBCQuery.ParamByName('SAISON').AsString:=SAISON; 
IBCQuery.Execute;
IBCTRANSACTION.CommitRetaining;

michaelJ
Posts: 30
Joined: Thu 13 Jan 2011 16:11

Post by michaelJ » Tue 30 Aug 2011 13:55

I've tried this already before, but the second statements makes no update. I didn't know why.
So aktually I use a workaround and rename the parameter in the second statement from INFOMEMO to INFOMEMOX. That works, but this ist not really nice...

Michael

AndreyZ

Post by AndreyZ » Wed 31 Aug 2011 13:59

The second statement could have made no updates if the INFOMEMO parameter contained the same value as was already stored in the MEMOTEXT field in your database. Please check this situation again, and if you can reproduce the problem when the second statement makes no changes, please compose a small sample to demonstrate this problem and send it to andreyz*devart*com, including a script to create and fill the AUSLIEF and ORDER_MEMO tables.

Post Reply