Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 11th, 2006, 10:28 PM
sillychuckie sillychuckie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 46 sillychuckie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 5 m 58 sec
Reputation Power: 5
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'.

Reply With Quote
  #2  
Old February 12th, 2006, 06:13 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 8,067 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 4 Weeks 2 h 10 sec
Reputation Power: 281
Just out of curiosity, why are you using objects inside the database?

Reply With Quote
  #3  
Old February 13th, 2006, 01:36 PM
sillychuckie sillychuckie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 46 sillychuckie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 5 m 58 sec
Reputation Power: 5
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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Constraining REF columns (unique)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT