SQL statement doesn’t return rows
Posted: Mon 08 Aug 2005 16:48
Hi, I work with D6.Update2, component ODACnet 4.50.3.24 and Oracle 9i and I have the following problem: When I erase all the data of an OraQuery1, he appears me the following message:
Debugger Exception Notification
Project prueba.exe raised exception class Exception with message "SQL statement doesn't return rows". Process stopped. Step or use Run to it continued.
Subsequently in the OraQuery1 where I have erased the data, I cannot add any registration, until I don't make a consultation previously, this also happens me every time that I insert a registration.
My question is, if somebody can tell me because if I erase the OraQuery1 with the order "DELETE FROM & tablename1", or I insert a registration by means of "INSERT INTO… ", he appears me this exception.
I use the following code:
Best regards,
Debugger Exception Notification
Project prueba.exe raised exception class Exception with message "SQL statement doesn't return rows". Process stopped. Step or use Run to it continued.
Subsequently in the OraQuery1 where I have erased the data, I cannot add any registration, until I don't make a consultation previously, this also happens me every time that I insert a registration.
My question is, if somebody can tell me because if I erase the OraQuery1 with the order "DELETE FROM & tablename1", or I insert a registration by means of "INSERT INTO… ", he appears me this exception.
I use the following code:
Code: Select all
procedure TfLiq.Btn_borrar_todoClick(Sender: TObject);
begin
Try
fdm.OraQuery1.SQL.Clear;
fdm.tbLiq.Open;
fdm.OraQuery1.SQL.Text := 'DELETE FROM &tablename1';
fdm.OraQuery1.MacroByName('TableName1').Value := 'desarrollo.ta_liquidaciones';
fdm.OraQuery1.execute;
except
on E : Exception do
ShowMessage(E.ClassName+' mensaje del error : '+E.Message);
end;
Code: Select all
procedure TfLiq.grabaSQLliq;
begin
if fDM.OraQuery1.active=false then fDM.OraQuery1.active:=true;
fdm.tbLiq.Open;
fdm.OraQuery1.SQL.clear;
fdm.OraQuery1.SQL.Text:=
'INSERT INTO &tablename'+#13+
'(A_BAJA, A_APLAZADA, C_NUM_OFICINA, N_NUM_YEAR, N_NUM_ORDEN,'+#13+
' N_NUM_BIS, N_NUM_FRAC, C_NIF, N_VERSION, A_NOMBRE, A_DIRECCION,'+#13+
' A_MUNICIPIO, C_COD_POSTAL, A_PROVINCIA, C_NIF_REPRESENTANTE)'+#13+
' VALUES '+#13+
'(:A_BAJA, :A_APLAZADA, :C_NUM_OFICINA, :N_NUM_YEAR, :N_NUM_ORDEN,'+#13+
' :N_NUM_BIS, :N_NUM_FRAC, :C_NIF, :N_VERSION, :A_NOMBRE, :A_DIRECCION,'+#13+
' :A_MUNICIPIO, :C_COD_POSTAL, :A_PROVINCIA, :C_NIF_REPRESENTANTE)'+#13+
'RETURNING'+#13+
' N_NUM_ORDEN'+#13+
'INTO'+#13+
' :N_NUM_ORDEN';
fdm.OraQuery1.MacroByName('TableName').Value := 'Desarrollo.ta_liquidaciones';
fdm.OraQuery1.ParamByName('C_NUM_OFICINA').AsString := num_oficina.text;
fdm.OraQuery1.ParamByName('N_NUM_YEAR').AsString := Num_year.text;
fdm.OraQuery1.ParamByName('N_NUM_ORDEN').AsString := Num_Orden.Text;
fdm.OraQuery1.ParamByName('N_NUM_BIS').AsString := Num_bis.text;
fdm.OraQuery1.ParamByName('N_NUM_FRAC').AsString := num_frac.text;
fdm.OraQuery1.ParamByName('C_NIF').AsString := Nif.text;
fdm.OraQuery1.ParamByName('N_VERSION').AsString := Version.text;
fdm.OraQuery1.ParamByName('A_NOMBRE').AsString := Nombre.text;
fdm.OraQuery1.ParamByName('A_DIRECCION').AsString := Direccion.text;
fdm.OraQuery1.ParamByName('A_MUNICIPIO').AsString := Municipio.text;
fdm.OraQuery1.ParamByName('C_COD_POSTAL').AsString := Cod_postal.text;
fdm.OraQuery1.ParamByName('A_PROVINCIA').AsString := Provincia.text;
fdm.OraQuery1.ParamByName('C_NIF_REPRESENTANTE').AsString := nif_r.text;
fdm.OraQuery1.prepared;
fdm.OraQuery1.execute;
end;