Synchronizing the values in the form with the record in Oracle

pts.
Tags:
Database
IBM DB2
Oracle
I am new to Oracle forms and am faced with a problem. For records of a certain type, instead of updating the current record with the values in the form items, I am creating a new record in the table with the same values, but with a new sequence number (the primary key is a combination of the code and sequence number) . I can get this to work by using an insert statement in the on-update trigger at the form level. The table is updated, however,the form does not show this new version of the record. It still shows the previous one. How can I get the form to show this recently inserted record? I could set the where clause in the block property to the code and sequence number of the new record and do an execute_query so it displays on the form, but then the user would not be able to scroll up and down to view the other records.

Answer Wiki

Thanks. We'll let you know when a new response is added.

I’ve never worked with Oracle forms, either, but the concept is simple enough. You’re looking at a particular record, say record 20, somewhere in the middle of your recordset/cursor when you do the insert. Based on your primary key, the new record would be record 21 if you ran the same query again, but that’s not happening, so that record isn’t part of your recordset. All the insert does is put the record in the table; it doesn’t affect the recordset you’re working with.

If there is a way to do an “Add New” on the recordset behind the form, as opposed to the table it’s based on, that would be half the solution; the reocrd would at least be there to scroll to. The forms technology might handle the other half, moving to the new record, or it might not. If not, it should be easy enough to do that yourself.

If there isn’t such an option, you’ll probably have to continue doing the Insert, but follow up with requerying the table, so the new record is part of the recordset. You shouldn’t need to change the Where clause, just execute the same query so the new record and the old records are all returned. (Assuming you don’t need to loosen up the criteria to have the new one included. But, don’t make it more restrictive.) Then use whatever move methods are available to move to your new record once the recordset is refreshed.

Sorry I can’t be more specific, but if you check the documentation, you should find what you need.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Gmenon
    [...] Address: http://itknowledgeexchange.techtarget.com/itanswers/synchronizing-the-values-in-the-form-with-the-re... (0) Comments Read [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following