Friday, April 20, 2012

Oracle Forms -- DML Returning Values

This is one of my most loved and hated properties in Oracle Forms.

If it is set to Yes, it makes it so that you automatically see not only user updates to a record, but any updates that may have happened on the database (ie, a trigger sets "Updated Date", etc.). Additionally, if this is set to Yes, you should not get the "record is locked by another user" message after you have committed, but attempt to edit the record again without re-querying.

So why in the world is it defaulted to No? Well, it's my understanding that this was done so that you don't break older code that may be running on a pre-Oracle 8 database.

The property works great, except when it doesn't. Occasionally, after a record update, you see a bunch of gobblydygook after it has committed. The extra junk isn't really there, and all you have to do is re-query the block to see that the records are fine, but it doesn't make my end-users happy.

And then today, I learned something that I didn't know before. If you set the "Query Only" to "yes"  property on an item in a block with DML Returning Values set to Yes -- well, the item doesn't return the value -- it appears as if the DML Returning Values property is set. I guess that this is because the dml return is considered part of the update process and the query only items are ignored at that point (I wouldn't have guessed it before, but it's my theory).

So, there you have it. For the one stray person who may stumble upon this post, I hope it helped :).