Geeks Talk

Prepare for your Next Interview




Inserting instead of updating

This is a discussion on Inserting instead of updating within the Oracle forums, part of the Databases category; Hello, I have written following code for update button in a form. It is inserting new record instead of updating existing record. Could you please suggest me what might be ...


Go Back   Geeks Talk > Databases > Oracle

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-14-2007
Expert Member
 
Join Date: Sep 2007
Posts: 619
Thanks: 22
Thanked 52 Times in 51 Posts
krishnaindia2007 is on a distinguished road
Inserting instead of updating

Hello,

I have written following code for update button in a form. It is inserting new record instead of updating existing record. Could you please suggest me what might be the problem?

IF :System.Form_Status = 'CHANGED' THEN
UPDATE DSL_SUPPLIER_MASTER
SET DSL_SUPP_ADD1 = : DSL_SUPP_ADD1,
DSL_SUPP_ADD2 = : DSL_SUPP_ADD2,
DSL_SUPP_ADD3 = : DSL_SUPP_ADD3,
DSL_CREATEDDATE = SYSDATE
WHERE LTRIM(RTRIM(DSL_SUPP_NAME)) = LTRIM(RTRIM(: DSL_SUPP_NAME))
AND LTRIM(RTRIM(DSL_SUPP_CODE)) = LTRIM(RTRIM(: DSL_SUPP_CODE));
END IF;
Commit;

Thanks in advance.
Krishna
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-15-2007
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,330
Thanks: 7
Thanked 117 Times in 106 Posts
debasisdas will become famous soon enoughdebasisdas will become famous soon enough
Re: Inserting instead of updating

There is nothing wrong with the code. Kindle check that this is the code that is executing on the click of your Update button.
Reply With Quote
  #3 (permalink)  
Old 10-10-2007
Expert Member
 
Join Date: Apr 2007
Posts: 404
Thanks: 13
Thanked 52 Times in 52 Posts
susarlasireesha is on a distinguished road
Re: Inserting instead of updating

New Row is inserted because u used commit at the end of updation u try forms_ddl('Commit') .I think it will work
Reply With Quote
The Following User Says Thank You to susarlasireesha For This Useful Post:
  #4 (permalink)  
Old 10-14-2007
Junior Member
 
Join Date: Sep 2007
Location: bangalore
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
jag_swathi is on a distinguished road
Thumbs up Re: Inserting instead of updating

please check the form status by putting in message of when-button-pressed trigger.

the commit built-in is inserting the record because of unchanged form status.

in case u can not find it put break and debug it.
Reply With Quote
  #5 (permalink)  
Old 10-15-2007
Junior Member
 
Join Date: Sep 2006
Location: Pune, India
Posts: 10
Thanks: 1
Thanked 1 Time in 1 Post
lhariPrasad is on a distinguished road
Re: Inserting instead of updating

nothing wrong with the code, cross check for the form status and the action carried out thereof, SQL has not become intelligent to perform an Insert instead of Update
Reply With Quote
Reply

  Geeks Talk > Databases > Oracle


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Cyclic Updating JobHelper Oracle 2 10-13-2007 04:06 AM
Error while inserting or updating Geek_Guest SQL 1 09-09-2007 10:28 AM
Inserting nextval after sequence has reached maximum value Geek_Guest Oracle 7 08-14-2007 07:51 AM
Inserting column in existing table svigneshwari Oracle 4 07-30-2007 09:31 AM
Updating Java version Geek_Guest Java 1 04-16-2007 08:13 AM


All times are GMT -4. The time now is 10:56 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved