Home » Developer & Programmer » Forms » Update statement on button (Forms 6i)
Update statement on button [message #451677] Fri, 16 April 2010 01:49 Go to next message
namb
Messages: 35
Registered: September 2009
Member
I try to apply update statement on the button for the specific records, the command does executes if in the end i write execute_query it always asks for do u wanna save the records, yes or no. I want to remove that message. Also if i write commit it does remove that message but everytime i press the button it updates the old record fine but also adds one more entry for the same record. Can someone guide me abt the duplication why it is happening.

Thanks in advance
Re: Update statement on button [message #451679 is a reply to message #451677] Fri, 16 April 2010 01:59 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
UPDATE does not insert records, so - it is not to be blamed.

How do you fetch records into a form? Is it by executing a query? If so, it shouldn't happen either.
But, if you - for example - populate a block in a loop, then Forms think that these are NEW records (not the ones that already exist in the database) so - your UPDATE statement updates "old" records (that are already in the table), but commit also inserts "duplicates" (records in a form) into the same table. If there was unique index there, you'd probably get an error.

I guess that you'll have to redesign this solution.
Re: Update statement on button [message #451824 is a reply to message #451679] Sat, 17 April 2010 02:38 Go to previous messageGo to next message
namb
Messages: 35
Registered: September 2009
Member
If i do not write commit and only write the update it does not update any of the rows. Can u please suggest why is it so
Re: Update statement on button [message #451841 is a reply to message #451824] Sat, 17 April 2010 07:08 Go to previous messageGo to next message
shaz
Messages: 182
Registered: June 2009
Senior Member
COMMIT statement is used to end the current transaction and make permanent all changes performed in the transaction.

COMMIT makes permanent any database changes you made during the current transaction. Until you commit your changes, other users cannot see them. Hence Commit is needed after you apply update.

N.B.: A transaction is a sequence of SQL statements that Oracle Database treats as a single unit.

Re: Update statement on button [message #451842 is a reply to message #451677] Sat, 17 April 2010 07:11 Go to previous messageGo to next message
kojot
Messages: 27
Registered: December 2009
Location: Poland
Junior Member
If you update using just sql statement, you should use 'standard.commit', but, if you change value in forms by text item, then use 'commit'.

If forms inserting a new records, while you think it should update, you should redisgn your form as Littlefoot suggest.
Re: Update statement on button [message #451846 is a reply to message #451842] Sat, 17 April 2010 07:21 Go to previous message
shaz
Messages: 182
Registered: June 2009
Senior Member
Yap I also agree.
Previous Topic: Login page
Next Topic: FRM-30058: Invalid name for a record group column (merged by CM)
Goto Forum:
  


Current Time: Fri Sep 20 05:31:33 CDT 2024