• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

delete details record

hi
what is the code to delete details record in the form
thanx
0
NiceMan331
Asked:
NiceMan331
  • 7
  • 5
  • 2
  • +1
1 Solution
 
flow01Commented:
basicaly

go_block('details');
delete_record;

But somehow I expect this might  not bring you the behaviour you want. If that is true , try telling some more.
0
 
DavidSenior Oracle Database AdministratorCommented:
Is this really an Oracle question, with ADF, or an old Forms app?  And are you trying to resolve something specific to the form, as compared to the underlying SQL?  Versions and specifics, please.
0
 
NiceMan331Author Commented:
oracle 10g
forms 6i
i have form : master/details
i want to set the cursor on one record on the details then click the button to delete it
exactly as you use shift f6
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
flow01Commented:
add a when_button_pressed trigger to the button

begin
  delete_record;
end;

beware : it could mimic shift f6 also when the cursor is in the master block
0
 
NiceMan331Author Commented:
yes , it was my mistake
i forget to put the button on the details block
it is ok now
but still one issue :
this button now included in the navigation of the record
how i can avoid it from the navigation to let the cursor move directly to the next record without passing that button ?
i know putting it on the master will solve the issue , but what about the current issue
0
 
NiceMan331Author Commented:
another question :
after deleting the same record , could it undo by another button ?
0
 
DavidSenior Oracle Database AdministratorCommented:
Assuming your delete button does an auto-commit, I'd advise a qualified no.  Once the transaction has been committed, a prior state may be recovered with flashback logs -- but I'd hate to see that coded into a control.
0
 
flow01Commented:
Navigation
look at the properties of your button ,
keep it enabled but set keyboard and mouse navigation to no.

The delete_record marks the row as deleted within the Oracle form and the record is not yet deleted in the database. The changes are applied to the database if you use the POST or COMMIT build-ins.
Oracle forms by default asks to commit  al the changes made in the form that are  not yet committed,
if you don't accept  the delete will not be posted to the database , but also al other changes in this form after the last commit will be lost.

You can also issue a savepoint you can return to (as does oracle forms when entering a new form), but unless very much needed I would relay on standard behaviour of Oracle Forms. Deviation without knowledge is asking for trouble.
0
 
Mark GeerlingsDatabase AdministratorCommented:
In addition to setting "keyboard and mouse navigation to no" for this button, also go to the properties page for the previous item in the details block and choose a value for "Next Navigation Item" to the item in this block that you want the cursor to skip ahead to when the user presses the [Tab] key, and go to the properties page for the next item in this block (or the first item, if this "delete" button is the last item in the block) and choose a value for "Previous Navigation Item" that the cursor should skip back to if the user presses [Shift]-[Tab].

"after deleting the same record , could it undo by another button ?"
The simple answer: no.

First, how could this button know which record you would want it to undelete?  Then, depending on exactly what action you have the "delete" button do, reversing that action could be complex, expecially if you include a "post" or "commit" in the delete button.  If the delete button just does a "delete_record" then you could easily reverse that with a "clear_block".  But, this will reverse more than just any deletes that have been done.  This will undo everything since the latest save.
0
 
flow01Commented:
As far as I know changing next and previous item is not necessary, and does the form automatically skip a non-key-navigable item , but if markgeer advises it , he will probably have his reasons for it.  You can easily find out for yourself. Let's hear the result.
0
 
NiceMan331Author Commented:
sorry for delay
i were in hospital
flow are right
i tried setting navigation keyboard & mouse to no , it is enough
correct
actually the question answered already , if you like , i could open a new question for the next

regarding delete record , your logic is correct also if the record previously saved
then no need to accept the changes when the form ask
but my issue is if i'm posting new main record , having for example 1000 records as details
ok , while typing those thousands , i deleted one record , then i found that it should not be deleted , here the total record not yet saved in the database
is there any way to retrieved that deleted record ?
0
 
flow01Commented:
Yes.  Create  a extra table simular to your detail-records . (detail_del)
Create a procedure with a  pragma autonomous_transaction  to store records ,
and as argument the record_type of the detail-record.  In the procedure insert the (detail_del) record.

call the procedure before issuing the delete_record built in.

Lot's of trouble ahead :  do you also want to store updates, if there are more deleted records how to retrieve the good one,  what to happens if you delete, enter a new record your self with the same primary key and try to get back the deleted_record and so on.
0
 
NiceMan331Author Commented:
Create a procedure with a  pragma autonomous_transaction  to store records ,

is it special procedure ? i didn't hear before about it
but any how , i understood your idea , it is really smart one

do you also want to store updates
if there are more deleted records how to retrieve the good one,  

here i would like to retrivet the last one delted or updated , it is enough for me
0
 
Mark GeerlingsDatabase AdministratorCommented:
"is it special procedure?"
Yes, this would be a "special" or at least a custom procedure, since you would need to write this for your application.

"i didn't hear before about it"
What exactly do you mean by "it" here?  Do you mean this: "pragma autonomous_transaction"?

That is a way to have a procedure commit its work independent of whether your main application does a commit, or not.

" i understood your idea, it is really smart one"
Be careful!  Adding complexity is not always a good idea.

"I would like to retrieve the last one deleted or updated".  This could get complex.  Will there only be one user doing this work at a time?  Most applications allow multiple poeple to make changes at about the same time.  Do you have to be able to retrieve the latest one for the current user?
0
 
NiceMan331Author Commented:
"I would like to retrieve the last one deleted or updated".  This could get complex.  Will there only be one user doing this work at a time?  Most applications allow multiple poeple to make changes at about the same time.  Do you have to be able to retrieve the latest one for the current user?



actuallt they are one use only
0
 
NiceMan331Author Commented:
flow
i will accept your solution
i will try your suggestions regarding deleting the table
if i fail , i will post a new topic
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 7
  • 5
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now