Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Constriant

610101Nov 9 2009 — edited Dec 1 2009
I want to add a constriant to restrict the insert on a Table after checking the qty in a column of another Table.
For ex: I have
TABLE1
CR_ID
FINISH
QTY

TABLE2
CRI_ID
CRI_CR_ID
R_CODE
R_QTY

Suppose QTY is 100 (100 is the qty for FINISH product)

And R_CODE is raw material code, which in various combination makes one FINISH.

Inorder to produce FINISH of 100 qty, two or three R_CODE are entered.(For ex: for difference R_CODE'S different R_QTY ( 50, 10, 40 ))

At anytime the sum of R_QTY should not exceed QTY
i.e SUM(R_QTY) = QTY
where CR_ID = CRI_CR_ID

I don't know how to handle this. shall i write constraint ? But how can i write a constraint on one table based on value on another table?

Yogesh
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 29 2009
Added on Nov 9 2009
3 comments
354 views