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
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.
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
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.
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 :confused: