Home » Developer & Programmer » Forms » how to update records in a table having primary key
icon2.gif  how to update records in a table having primary key [message #214794] Thu, 18 January 2007 02:12 Go to next message
pushpendra.tomar
Messages: 11
Registered: January 2007
Location: Hyderabad
Junior Member
Hi All,

I know this is a very small problem...but as I am new to forms,
hence I am unable to resolve this issue.

I want to update records in a table thorugh forms 6i.

For this I wrote the code in "when-button-pressed" trigger:

update ibt_books_category
set book_category = :IBC.book_category
where sub_category = :IBC.sub_category;

Here
ibt_books_category -> table name
sub_category ->column name (primary key)
book_category -> column name
IBC -> data block name
book_category -> item name
sub_category -> item name

Now when I press this button...nothing happens.. but when I close
the form..I get a message "do you want to save changes you made"
when I press OK button, it gives me error "Unable to insert record"
I don't know why this SQL command is not working in form's trigger.

Please help

Thanks

Pushpendra
Re: how to update records in a table having primary key [message #214924 is a reply to message #214794] Thu, 18 January 2007 10:58 Go to previous messageGo to next message
scorpio_biker
Messages: 154
Registered: November 2005
Location: Kent, England
Senior Member
Hi,

The update won't take place until you issue a commit, which is why you are getting the message when you close the form, as Oracle tries to perform the uncommited transactions.

Try doing a commit after your update statement and add some error trapping to see why it can't insert the record.

Hope this helps
Re: how to update records in a table having primary key [message #214996 is a reply to message #214794] Thu, 18 January 2007 21:14 Go to previous message
ab_trivedi
Messages: 460
Registered: August 2006
Location: Pune, India
Senior Member
Hi P,

You see in you base block,

1)the properties of the item you are updating is it yes/no.
2)check if the the where is correct or not.
3)in your primary key make sure you are not violating primary
key constraint.

Bye
Ashu

[Updated on: Thu, 18 January 2007 21:17]

Report message to a moderator

Previous Topic: Access Message problem when Send e-mail from Outlook 2003
Next Topic: which trigger
Goto Forum:
  


Current Time: Mon Mar 10 02:34:49 CDT 2025