DML Returning Value, on-update and field update [message #396426] |
Mon, 06 April 2009 10:47 |
|
didiera
Messages: 134 Registered: August 2007 Location: Mauritius
|
Senior Member |
|
|
Hello again everyone,
I have asked a similar question in a previous post but this time, it's a bit different. I have a database block based on a table for which there exist triggers before Insert and Update respectively. I have 'created' and 'updated' fields which are populated as records are inserted or updated by users. These fields are represented on my data block in Forms, but when I change another value of a given record and do a save, then try to modify the record. I get the error "Record has already been modified by another user" - Obviously because the update trigger changed the value for the 'updated' field of the same record. The table behind this block also has a primary key for which block I set the DML Returning Value field to 'Yes' and identified the 'ID' field as primary key with an 'Initial Value' property of :sequences.my_sequence.nextval ...all this is just fine. But how do I work around the 'updated' field thing except from requerying the whole block after each save?
In fact I'm thinking of substituting the 'updated' field on the block by a formula-based thing...would that work (I don't mind if its not exactly in synch with it's table counterpart)?
regards,
Didier
|
|
|
Re: DML Returning Value, on-update and field update [message #396583 is a reply to message #396426] |
Tue, 07 April 2009 04:49 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
If you've got DML return set to yes then I very much doubt it's the database triggers that are causing your "Record has already been modified by another user".
Couple of other possibilities:
do you do any direct update statements on the table?
Have you got any code on your detail block (if it is master detail) that modifies items in the master block?
|
|
|
|
|
|
|
|
Re: DML Returning Value, on-update and field update [message #396872 is a reply to message #396426] |
Wed, 08 April 2009 04:24 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You really need to sort out your terminology.
There's no such thing as an on-update database trigger.
There is before update and after update.
On-update is a forms trigger that overrides the forms default update behavoiur.
I would assume your trigger is a before update row trigger.
If that's what you've got them dml return should definitely work.
If your workaround works great, but I suspect you have another problem you don't know about.
|
|
|
|