Home » Developer & Programmer » Forms » Foreign key
Foreign key [message #149426] Thu, 01 December 2005 14:16 Go to next message
orate
Messages: 16
Registered: September 2005
Junior Member
I have a table A with primary key a, and a table B with a column b which references column a in A (foreign key).
There is a form to maintain table A (query, insert, update and delete).
If the user tries to update the field a of a record, and there are rows in B that reference that value of a,
1 - does Oracle Forms allow that update?
2 - in that case, how can I update the rows of B accordingly?
Re: Foreign key [message #149511 is a reply to message #149426] Fri, 02 December 2005 01:36 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Wow, an updatable foreign key? That's not the brightest idea I'm afraid.

Normally it isn't allowed. I think I would opt for one of these:
- search for an alternative and let the FK be (you can use a technical FK column which remains hidden for the end users).
- duplicate the original master record, but with the new FK value, change the child records from the old master record to the new and delete the old master record.

The first solution is the best, IMO: don't fiddle with the FK itself.

MHE
Re: Foreign key [message #150062 is a reply to message #149426] Tue, 06 December 2005 02:13 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have you solved your problem?

David
Re: Foreign key [message #151218 is a reply to message #149426] Tue, 13 December 2005 16:58 Go to previous messageGo to next message
orate
Messages: 16
Registered: September 2005
Junior Member
I set "Update allowed" to false at item a.

"Delete allowed" is set to true at block A, but if there are rows in B which reference a, I don't allow the deletion.

Re: Foreign key [message #151228 is a reply to message #151218] Tue, 13 December 2005 17:47 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Is that a 'yes - everything is working the way I want it to, thanks' or 'no - I still have this behaviour <detail behaviour> which I do not want'?

David
Re: Foreign key [message #151588 is a reply to message #149426] Thu, 15 December 2005 15:19 Go to previous message
orate
Messages: 16
Registered: September 2005
Junior Member
Yes, everything is working the way I want it to, thanks'
Previous Topic: After deleting a constraint, i am getting the constraint violation problem.
Next Topic: oracle form download
Goto Forum:
  


Current Time: Fri Sep 20 06:40:20 CDT 2024