Thread: Autopopulate PK from another PK
05-16-08, 13:43 #1Registered User
- Join Date
- Apr 2008
Unanswered: Autopopulate PK from another PK
I have tables A and B.
A consists of Sales, their ID and other stuff. Table B has a foreign key the PK from A and also foreign key the PK of the product sold, quantity, price and other.
So the PK of B is made of PK of A and PK of Product.
Table A's PK is populated with a trigger from a sequence. What I want is when a new sale occurs, the FK which is from the side of A, to be autopopulated from the value of the PK of A. The Product ID will be manually entered.
Is there any way to do this, like with triggers or anything else?
help is apreciated
05-16-08, 14:03 #2Registered User
Provided Answers: 1
- Join Date
- Aug 2003
- Where the Surf Meets the Turf @Del Mar, CA
>Is there any way to do this, like with triggers or anything else?
Only if you have the ability to modify the application code to do what you have described.
Code running inside of Oracle RDBMS has to easy/direct way to interact with user.You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Good judgement comes from experience. Experience comes from bad judgement.