Solved

delete details record

Posted on 2013-12-27
16
369 Views
Last Modified: 2014-01-17
hi
what is the code to delete details record in the form
thanx
0
Comment
Question by:NiceMan331
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 2
  • +1
16 Comments
 
LVL 20

Expert Comment

by:flow01
ID: 39743948
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
 
LVL 23

Expert Comment

by:David
ID: 39743989
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
 

Author Comment

by:NiceMan331
ID: 39744547
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 20

Expert Comment

by:flow01
ID: 39745035
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
 

Author Comment

by:NiceMan331
ID: 39747701
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
 

Author Comment

by:NiceMan331
ID: 39747702
another question :
after deleting the same record , could it undo by another button ?
0
 
LVL 23

Expert Comment

by:David
ID: 39748463
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
 
LVL 20

Expert Comment

by:flow01
ID: 39748582
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
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 39748721
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
 
LVL 20

Accepted Solution

by:
flow01 earned 500 total points
ID: 39748828
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
 

Author Comment

by:NiceMan331
ID: 39764352
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
 
LVL 20

Expert Comment

by:flow01
ID: 39764637
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
 

Author Comment

by:NiceMan331
ID: 39764661
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
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 39765110
"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
 

Author Comment

by:NiceMan331
ID: 39772995
"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
 

Author Comment

by:NiceMan331
ID: 39789523
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question