Home » SQL & PL/SQL » SQL & PL/SQL » constraint question
constraint question [message #21057] Tue, 09 July 2002 14:55 Go to next message
JSlick
Messages: 15
Registered: July 2002
Junior Member
If I define a referential constraint within a create table statement:

create table T (
---
partid CONSTRAINT fk_material REFERENCES MATERIAL(id) ON DELETE CASCADE,
---
)

...is there a way to define that constraint so that it can be used again, in a different table, or do I always have to create a unique constraint name?

I guess I want a global constraint, but I'm probably taking a naive approach.

Thanks!
Re: constraint question [message #21059 is a reply to message #21057] Tue, 09 July 2002 21:32 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Since a referential constraint is defined as a specific relationship between a column(s) in a table and the/a primary/unique key of a table, the name must be unique.

Just for thought: If there were such a thing as a "global" constraint, how would you ever know for sure which tables were involved when a constraint was violated?
Re: constraint question [message #21068 is a reply to message #21057] Wed, 10 July 2002 06:55 Go to previous message
m.irfan
Messages: 3
Registered: July 2002
Junior Member
dear sir
plz let me about the main difference between unique key and pirmary key.
what is the purpose of more than one primary key in the same table with example.
regards,
urs sincerly
irfan
Previous Topic: CURSOR or resultset or what?
Next Topic: MAX function with VARCHAR2 field
Goto Forum:
  


Current Time: Fri Apr 26 15:35:51 CDT 2024