Results 1 to 5 of 5

Thread: Inserting instead of updating

  1. #1
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    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


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    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.


  3. #3
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    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


  4. #4
    Junior Member
    Join Date
    Sep 2007
    Answers
    2

    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.


  5. #5
    Junior Member
    Join Date
    Sep 2006
    Answers
    9

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact