Page 1 of 1

Dynamic SQL Error SQL error code =-303 internal error

Posted: Tue 30 Aug 2011 10:29
by michaelJ
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.

Posted: Tue 30 Aug 2011 12:49
by AndreyZ
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;

Posted: Tue 30 Aug 2011 13:55
by michaelJ
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

Posted: Wed 31 Aug 2011 13:59
by AndreyZ
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.