I'm not an Oracle forms guy, but I'm stuck maintaining an old Oracle Forms 6i app that our company has, so I apologize if I sound like I don't really understand forms, because I don't.
We have a pre-existing form that I've had to make some change to. It has a master/detail type setup. There are a series of "rows" for the details. When I enter master info and the first detail record, I can save just fine. When I add a second row of info to the details section, it gets to the KEY-COMMIT trigger, but when it actually hits the "commit;" line, it gives me the error "Record has already been inserted."
But there is only the one record associated with the master details in the table. When I clear that message it asks, "Do you want to save the changes you have made?" If I click "Yes", it just gives me the "Record has already been inserted" message in the status bar and nothing happens. If I try to exit the form, it again asks if I want to save the changes, but "yes" does nothing but keep me on the form. Clicking "No" removes the second detail record.
I'm confused. I'm clearly missing something.
Your detail data block has the
Enforce Primary Key property
set to Yes. It means that rows inserted/updated/deleted by this block are not queried by rowid, but by primary key.It does not matter, how is primary key set in database, but how is set in forms. Check all items in your detail block and find those with
Primary Key (Item)
property. Then check, if there is a duplicate record in database.I prefer using rowid and uncheck
Enforce Primary Key property
. If your block works directly with database table (not view), it works fine