OnApplyRecord

nico

Member²
I want to insert,update delete a table with the OnApplyRecord event. The rowid is selected in the SQL statement.

procedure
TMyForm.OracleDataSet1ApplyRecord(Sender: TOracleDataSet; Action: Char; var Applied: Boolean; var NewRowId: String);
var
RetVal: Integer;
begin
Applied := False;
case Action of
'I','U':
begin
try
MyPackage.CallProcedure('insert_update_proc',[...]);

NewRowID := MyPackage.GetParameter('NEWROWID');
Applied := True;
except
NewRowID := '';
Applied := False;
end;
end;
'D':
....
...
end;

Normaly I get the NewRowId from my PL/SQL procedure. But if an error occures while inserting a dataset, there isn't a valid rowid . When I set NewRowID := '' a ORA-01779 occures. When I set NewRowID := Null a Delphi error occures.
How can I solve this problem.
 
If you get an exception, you need to propagate it (or leave it unhandled). This way the dataset knows the insert has failed, and will act accordingly.

------------------
Marco Kalter
Allround Automations
 
Back
Top