Home » Developer & Programmer » Forms » Update help (merged 2) (form 10g)
Update help (merged 2) [message #552026] Mon, 23 April 2012 04:24 Go to next message
chinaexpat
Messages: 6
Registered: April 2012
Junior Member
I am new to forms. I have a form called University. The form using Oracle standard tool bar to execute query and to update a record. After I change a record with any column and click on Save button. It does not update any records. Why is that? Do I need to do a update trigger and can anybody please give me an example, if I need to create a update trigger? Thanks.

Re: Update help [message #552028 is a reply to message #552026] Mon, 23 April 2012 04:28 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
No you don't need a trigger. It should just update automatically, so you've probably done something to prevent that happening.
Start by creating a pre-update trigger on the block and put a message in it - run the form and see if the message appears.
Re: Update help [message #552039 is a reply to message #552028] Mon, 23 April 2012 05:05 Go to previous messageGo to next message
chinaexpat
Messages: 6
Registered: April 2012
Junior Member
I have a pre-update trigger in the block and only update two fields. Do I need to add more codes to make sure to update any other column that had been updated?

Here is the code

DECLARE
CURSOR user_id IS select user from dual;
CURSOR update_date IS select SYSDATE from dual;
BEGIN

OPEN user_id;
FETCH user_id INTO :eis_university.last_updated_by;
CLOSE user_id;

OPEN update_date;
FETCH update_date INTO :eis_university.last_updated_date;
CLOSE update_date;

IF :eis_university.created_by IS NULL THEN
Message('error Generating last_updated_by')');
RAISE Form_trigger_Failure;
END IF;
IF :eis_university.creation_date IS NULL THEN
Message('error Generating last_updated_date')');
RAISE Form_trigger_Failure;
END IF;
END;
Re: Update help [message #552040 is a reply to message #552039] Mon, 23 April 2012 05:09 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
1) Please read and follow How to use [code] tags and make your code easier to read?
2) Selecting from dual like that is a waste of time, just assign the values directly:
:eis_university.created_by := user;
:eis_university.creation_date := sysdate;

3) They are never going to be null so those IF statements are a waste of time.
4) Are you actually modifying any items in the form before you press save?
Re: Update help [message #552041 is a reply to message #552040] Mon, 23 April 2012 05:22 Go to previous messageGo to next message
chinaexpat
Messages: 6
Registered: April 2012
Junior Member
Thanks,

Yes, I modified any items in the form, and pressed save and it showed "Transaction complete:1 record applied and saved" and it did not reflect any changes that I made in the table.
Re: Update help [message #552043 is a reply to message #552041] Mon, 23 April 2012 05:28 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
it did not reflect any changes that I made in the table.

How did you check that?
Re: Update help [message #552044 is a reply to message #552043] Mon, 23 April 2012 05:33 Go to previous messageGo to next message
chinaexpat
Messages: 6
Registered: April 2012
Junior Member
I meant changes I made in the form.
Re: Update help [message #552046 is a reply to message #552044] Mon, 23 April 2012 05:35 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I know, but - how did you do that? Re-querying the form? In SQL*Plus? Something different?
Re: Update help [message #552071 is a reply to message #552046] Mon, 23 April 2012 07:19 Go to previous messageGo to next message
chinaexpat
Messages: 6
Registered: April 2012
Junior Member
I re-query the form and use PL/Sql developer.
Re: Update help [message #552073 is a reply to message #552071] Mon, 23 April 2012 07:31 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
The obvious thing to do is run a SQL trace and see what exact update the form is sending to the DB.

[Updated on: Mon, 23 April 2012 07:31]

Report message to a moderator

Re: Update help [message #552122 is a reply to message #552073] Mon, 23 April 2012 11:36 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Are these items (you modified in a form) based on table (you based a block on) columns?
Re: Update help [message #552140 is a reply to message #552122] Mon, 23 April 2012 18:41 Go to previous messageGo to next message
chinaexpat
Messages: 6
Registered: April 2012
Junior Member
I solved the problem, I put the on_update on the form level not on the block level. thanks.

Re: Update help [message #552152 is a reply to message #552140] Mon, 23 April 2012 23:59 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Thank you for letting us know.
Re: Update help [message #552182 is a reply to message #552152] Tue, 24 April 2012 03:45 Go to previous message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
You've got an on-update trigger?
Why?
You should never need one.
Previous Topic: Move cursor to another item from WHEN-VALIDATE-ITEM
Next Topic: IS Oracle Forms/Reports 4.5 supported on database 9i?
Goto Forum:
  


Current Time: Fri Jul 05 22:06:43 CDT 2024