Delete record with form's procedure or sql statment ?
Posted on 2004-10-20
Could someone could help me to find a best solution in such situation?
I am not satisfied with form's working while deleting record...
One way is to create a push_button and to write a built-in procedure delete_record in it's
when-button-pressed trigger or simply use form's button 'Remove'.
But when you can't delete record, you only get a message FRM-40510 ORACLE error: Unable to DELETE record. You don't see a reason why you can't delete record.
There is one more thing: how to force a commit after record disapares (deleted) from form?
For example: there are some records in a table, some of them are related with another's table records and cannot be deleted, others can be deleted.
I press 'Remove'. Record disapare from form. Think is everything ok.
Press again 'Remove' and again 'Remove' to delete more records.
After deletion, I want to leave a form and got a message 'Do you want to save changes you have made?'. When I press Yes, I got an error FRM-40510...
Event if there was only one non deletable record, I see all deleted records are recovered.
It seems, I have to press commit after every record delete and check if there is related records to handle this error. What would be solution in such situation?
Second way is to write your own procedure in when-button-pressed trigger.
Procrdure's code below:
'Delete from MySchema.T_Table1 where T_Table1.ID = :T_Table1.ID'
when exc_no_del then Message('Cannot delete record');
But why do such things when you have forms made for you?!? Is it a smart solution?
Also, there is some problem with code also
I have to write commit, otherwise, procedure doesn't delete a record.
But I got a message 'No change to save', while executing this procedure...
I have no ideas how to organize a delete in my forms :(
Could someone give me some advices?? I would be very thankful