FRM-40654 [message #510844] |
Wed, 08 June 2011 01:43 |
|
ankur8819
Messages: 17 Registered: May 2011 Location: India
|
Junior Member |
|
|
Hi,
My form consists of a Datablock.
There are 3 textboxes A(primary key) B C which maps to 3 columns in the databse.
When I tab out of textbox A ,corresponding values are populated in textboxes B and C.
My requirement is to update these values(B and C) into databse if these are changed on the form.
When I am trying to use an explicit update statement and commit after that its giving me "nable to commit duplicate values" due to primary key being violated.
How can I update it in database.
Please advice
Thanks
|
|
|
|
Re: FRM-40654 [message #510871 is a reply to message #510853] |
Wed, 08 June 2011 03:00 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
I bet the datablock is doing an insert automatically.
Is it a database block?
Are you populating it with select statements rather than execute_query?
|
|
|
|
|
|
Re: FRM-40654 [message #510884 is a reply to message #510883] |
Wed, 08 June 2011 03:33 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Then this behaviour is entirely predictable.
You populate a database block with a select statement.
As far as oracle is concerned these are new rows. If you don't use execute_query forms has no way of knowing the data you've put in the block already exists in table.
So it thinks it needs to insert those records to the DB.
So when you commit your update statement it does exactly that - and gets the unique key violation.
If you're going to bypass forms default processing you need to do it completely - so you'd need to make the block a non-database block.
Or you could just rely on the default processing to do all this - is there a particular reason why you're trying to bypass it?
|
|
|
|
Re: FRM-40654 [message #510896 is a reply to message #510890] |
Wed, 08 June 2011 03:56 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Perhaps you should write a brand new form. This time, use Data Block Wizard. It will create a form that will run perfectly well. All its built-in functionalities will be there. So, on order to display existing records, execute a query (enter query first; enter search criteria; execute query). Update values on a form. Push "Save" button to save those changes.
You should read some documentation in order to learn basics. It is difficult to create an application without knowing what your tool does and how it works.
|
|
|