|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Constraining REF columns (unique)
Hi there, How can I place a unique constraint on a table that holds REF values?
I am doing some work where I wish to assign an 'OFFER' to a 'CUSTOMER'. Both 'OFFER' and 'CUSTOMER' are objects and are represented in my script as 'Offer_objtyp' and 'Customer_objtyp'. Each is stored in their own object table, 'Offer_objtab' and 'Customer_objtab'. In order to assign the offers, I have a table that sits between them storing a Customer_objtyp, and an Offer_objtyp. Now, a customer can be assigned many offers and many offers can be assigned to many customers. An offer however, can only be assigned to a customer, once. I would like to place a composite key (primary key) constraint across both objects in my Offer_assignment_table. The table's structure is as follows: Code:
CREATE TABLE Offer_assignment_tbl ( customer REF Customer_objtyp SCOPE IS Customer_objtab, offer REF Offer_objtyp SCOPE IS Offer_objtab ); If I use a Primary key or UNIQUE constraint as usual, I am shown the error: "ORA-02329: column of datatype REF cannot be unique or a primary key". Thanks. p.s) Note: My Customer_objtyp has an attribute called 'ID' which I would like to use as the unique constraint value. The Offer_objtyp has an attirbute called 'Offer_no'. |
|
#2
|
||||
|
||||
|
Just out of curiosity, why are you using objects inside the database?
__________________
My blog Tutorials about OSS databases, DBMonster ... Contribute to OSS Development, fill bug reports! Developer Shed eSupport Commented my.ini/my.cnf (ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins Random data (with a bias) |
|
#3
|
|||
|
|||
|
Because our assignment requires us to.
Is this not the appropriate method of using OO in Oracle? If not, we are being taught incorrectly. Any idea about my original question? |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Constraining REF columns (unique) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|