COMMIT_FORM sequence of events [message #86080] |
Sun, 29 August 2004 01:18 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Malik Humaid
Messages: 14 Registered: June 2003
|
Junior Member |
|
|
When issueing commit_form, the sequence of events stops my from committing
The problem I am facing:
I have a Unique constraint on my table (a serial number) and the user can input a new record anywhere in the middle of the records, I then renumber all following numbers in the form , but when I commit I get the unique constraint violation error. I because it is because the INSERT is done first and the UPDATE later.
What is the best solution for this problem.?
|
|
|
|
Re: COMMIT_FORM sequence of events [message #86083 is a reply to message #86082] |
Sun, 29 August 2004 04:19 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Malik Humaid
Messages: 14 Registered: June 2003
|
Junior Member |
|
|
Omar,
Thanks for your reply, but the problem is that I do not want to lose thenew sequence of of my records
Supose I have the followig records
SR NAME
1 MALIK
2 OMAR
3 ZAID
4 SEIF
5 SULTAN
On my form I want to add SULEMAN BEFORE ZAID which will result in the following list but you will be unable to save yur form because on commit_form insert have priority over updates thus the uniqueness error will trigger because when inserting SULEMAN as 3 will occure before zaid has changed to 4. ....
SR NAME
1 MALIK
2 OMAR
3 SULEMAN
4 ZAID
5 SEIF
6 SULTAN
I hope this illustrates my problem better ...!
Thanks again
|
|
|
Re: COMMIT_FORM sequence of events [message #86099 is a reply to message #86083] |
Tue, 31 August 2004 13:49 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Zain
Messages: 30 Registered: October 2003
|
Member |
|
|
Malik, there are two quick solutions if you have the flexibility to modify your data model a little bit.
1 - If your data model is changed as follows, then the problem is solved. If SR column is the primary key, add another column such as Serial Nbr. Keep on generating values for SR primary key using the sequence. However, allow users to update, insert values in Serial Nbr column only. Do not display SR column on the Form.
2 - If data model cannot be changed and the form is as small as you have shown above, think of creating a control form. Do not base your block on the table. Instead write the code to insert or update values on key-commit trigger.
3 - If the above two suggestions are not flexible for you, think of using 'post' and 'savepoints'.
Zain.
|
|
|
|