I am migrating my connection to use Driver DevArt for firebird.
Previously, I used inserts that returned fields with "Returning" without problems.
But now, this same code returns the error:
vSQL := TSQLDataSet.Create(Self);
try
vSQL.SQLConnection := dmDDB.SQLConection;
vSQL.CommandText := 'update or insert into CAD_TAB_IBPT_CAB ' +
'(VERSAO,VIGENCIA_INI,VIGENCIA_FIM,UF,CHAVE) ' +
'values (:VERSAO,:VIGENCIA_INI,:VIGENCIA_FIM,:UF,:CHAVE)' +
'matching(UF,CHAVE) returning (CODIGO)';
vSQL.ParamByName('CHAVE').AsString := '10001';
vSQL.ParamByName('VERSAO').AsString := '2';
vSQL.ParamByName('VIGENCIA_INI').AsDate := now;
vSQL.ParamByName('VIGENCIA_FIM').AsDate := now;
vSQL.ParamByName('UF').AsString := 'RJ';
vSQL.Open;
a := vSQL.Fields[0].asstring;
if a <> '' then
showmessage(a);
finally
FreeAndNil(vSQL);
end;
Error:
exception class EDatabaseError with message 'Cursor not returned from Query'
If I add an output type parameter with the name CODIGO it will work, but I need to maintain compatibility with the 2 drivers.
Why doesn't this code work with the DevArt driver?
Thanks!