Home » Developer & Programmer » Forms » How to update record selected using LOV?
How to update record selected using LOV? [message #168813] Sun, 23 April 2006 04:13 Go to next message
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 #168857 is a reply to message #168813] Sun, 23 April 2006 19:53 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
To get existing records from the database, go into Enter_Query mode, use the LOV to populate some of the fields then Execute_Query to get the rest. To create new records then do a Create_Record, then use the LOV to populate some fields and then do your save/commit.

David
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 messageGo to next message
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 #169039 is a reply to message #169017] Mon, 24 April 2006 15:20 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What kind of an exception? Which item is the when-button-pressed trigger attached to?
Re: How to update record selected using LOV? [message #169199 is a reply to message #169039] Tue, 25 April 2006 13:56 Go to previous messageGo to next message
aimam
Messages: 4
Registered: April 2006
Junior Member
exception is:
FRM-40509: ORACLE error: unable to UPDATE record.

and obviously, i attatched trigger with push button item.
  • Attachment: lovdemo3.fmb
    (Size: 48.00KB, Downloaded 1124 times)
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 messageGo to next message
Littlefoot
Messages: 21818
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.

Re: How to update record selected using LOV? [message #169271 is a reply to message #169212] Wed, 26 April 2006 00:46 Go to previous message
aimam
Messages: 4
Registered: April 2006
Junior Member
sorry i upload the wrong file.

and Thanks a lot for your reply.

Previous Topic: LOV Record group
Next Topic: Install problems Forms6i on Win2000 64 bit
Goto Forum:
  


Current Time: Fri Sep 20 07:48:18 CDT 2024