How to update record selected using LOV? [message #168813] |
Sun, 23 April 2006 04:13 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
aimam
Messages: 4 Registered: April 2006
|
Junior Member |
|
|
I am concerned to know how to update records that are retrieved using LOVs. The selected record is subsitute/returned into its corresponding text fields(on canvas) that are associated with the data souce.
I try to use COMMIT and UPDATE query but both not working.
Any idea/help/advice?
Thanks.
|
|
|
|
Re: How to update record selected using LOV? [message #169017 is a reply to message #168857] |
Mon, 24 April 2006 13:21 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
aimam
Messages: 4 Registered: April 2006
|
Junior Member |
|
|
Thanks alot David.
in my sample application, text item name is deptno and dname and its data block name is dept. when i try to execute the following code on WHEN-BUTTON-PRESSED trigger it causes an exception.
<U>code:</U>
<B>UPDATE dept
set dept.dname = :dept.dname
WHERE dept.deptno = :dept.deptno;</B>
can u please tell me the reason behind it.
Thanks anyways.
|
|
|
|
|
Re: How to update record selected using LOV? [message #169212 is a reply to message #169199] |
Tue, 25 April 2006 15:03 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
You should better know what you're putting into triggers. Sample form isn't the one you were talking about previously.
Error you receive is UNABLE TO INSERT RECORD as the When-button-pressed trigger on "update" button has only one line: COMMIT. The "show lov" button gets a record and "update" tries to insert it into the table. Doing so, it violates the unique constraint and thus results in failure.
If you want to UPDATE records, fetch them using QUERY, not list of values, and everything will be fine.
If you want to INSERT new records, slightly different from existing ones, you could use list of values, but unique column value should be entered carefully or, even better, using a sequence which will prevent such errors.
|
|
|
|