Home » Developer & Programmer » Forms » FRM-40654 (Oracle forms 6i)
FRM-40654 [message #510844] Wed, 08 June 2011 01:43 Go to next message
ankur8819
Messages: 17
Registered: May 2011
Location: India
Junior Member
Hi,
My form consists of a Datablock.

There are 3 textboxes A(primary key) B C which maps to 3 columns in the databse.

When I tab out of textbox A ,corresponding values are populated in textboxes B and C.
My requirement is to update these values(B and C) into databse if these are changed on the form.

When I am trying to use an explicit update statement and commit after that its giving me "nable to commit duplicate values" due to primary key being violated.
How can I update it in database.
Please advice

Thanks
Re: FRM-40654 [message #510853 is a reply to message #510844] Wed, 08 June 2011 02:06 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
My requirement is to update these values(B and C) into databse if these are changed on the form.

Simply push the "Save" button. If a block is really a "database block", Forms will do that for you.

However, if you ran UPDATE (I suppose it looks like this):
update your_table set
  b = :block.b,
  c = :block.c
where a = :block.a;
how could it violate a primary key constraint?
Re: FRM-40654 [message #510871 is a reply to message #510853] Wed, 08 June 2011 03:00 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
I bet the datablock is doing an insert automatically.
Is it a database block?
Are you populating it with select statements rather than execute_query?
Re: FRM-40654 [message #510879 is a reply to message #510871] Wed, 08 June 2011 03:22 Go to previous messageGo to next message
ankur8819
Messages: 17
Registered: May 2011
Location: India
Junior Member
@ cookiemonster ..yes I am..
i am using Select INto clause to populate column B and c .

I am using the below query on the tab out of column A.
Select abc,def INTO :xyz.b,:xyz.c where ghi=:xyz.a;

I have attached a snapshot of the form.
/forum/fa/9072/0/
On the tabout of PArt_Num I am populating Effective_date and expiration_date using Select Into clause.
  • Attachment: untitled.PNG
    (Size: 18.48KB, Downloaded 1545 times)
Re: FRM-40654 [message #510881 is a reply to message #510879] Wed, 08 June 2011 03:25 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
And is it a database datablock?
Re: FRM-40654 [message #510883 is a reply to message #510881] Wed, 08 June 2011 03:28 Go to previous messageGo to next message
ankur8819
Messages: 17
Registered: May 2011
Location: India
Junior Member
yes
Re: FRM-40654 [message #510884 is a reply to message #510883] Wed, 08 June 2011 03:33 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Then this behaviour is entirely predictable.

You populate a database block with a select statement.
As far as oracle is concerned these are new rows. If you don't use execute_query forms has no way of knowing the data you've put in the block already exists in table.
So it thinks it needs to insert those records to the DB.
So when you commit your update statement it does exactly that - and gets the unique key violation.

If you're going to bypass forms default processing you need to do it completely - so you'd need to make the block a non-database block.

Or you could just rely on the default processing to do all this - is there a particular reason why you're trying to bypass it?
Re: FRM-40654 [message #510890 is a reply to message #510884] Wed, 08 June 2011 03:49 Go to previous messageGo to next message
ankur8819
Messages: 17
Registered: May 2011
Location: India
Junior Member
/forum/fa/9075/0/
I was not aware of this concept in Forms.
I am new to Oracle forms.

How should I proceed with it.
Do I need to override the default_where clause of the block to achieve this(populate other details into the textboxes)??

  • Attachment: untitled.PNG
    (Size: 11.16KB, Downloaded 1602 times)
Re: FRM-40654 [message #510896 is a reply to message #510890] Wed, 08 June 2011 03:56 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Perhaps you should write a brand new form. This time, use Data Block Wizard. It will create a form that will run perfectly well. All its built-in functionalities will be there. So, on order to display existing records, execute a query (enter query first; enter search criteria; execute query). Update values on a form. Push "Save" button to save those changes.

You should read some documentation in order to learn basics. It is difficult to create an application without knowing what your tool does and how it works.
Previous Topic: ORA-00942: table or view does not exist
Next Topic: Connection problem whit Oracle Forms 6i.
Goto Forum:
  


Current Time: Thu Sep 12 09:02:37 CDT 2024