Home » SQL & PL/SQL » SQL & PL/SQL » Constraints
Constraints [message #431374] Tue, 17 November 2009 03:40 Go to next message
GuestUser32
Messages: 26
Registered: August 2009
Junior Member
Hi

Is it possible to run a query to see all constraints in a database?

I ask because I have a script which is creating a table but it says 'name already used by an existing constraint'.

Thanks
Re: Viewing Constraints [message #431377 is a reply to message #431374] Tue, 17 November 2009 03:43 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
It`s a FAQ.Search before posting here...And dont multi post...

Sriram Smile
Re: Constraints [message #431380 is a reply to message #431374] Tue, 17 November 2009 03:46 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Stop multi posting... i already replied for one of your multi posted Topics .

Search before posting Smile
Re: Constraints [message #431384 is a reply to message #431374] Tue, 17 November 2009 03:49 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
YOu just need to look at the constraints in your schema - constraint names are unique in a schema, not in a database.

Look at the USER_CONSTRAINTS view.
Re: Constraints [message #431386 is a reply to message #431374] Tue, 17 November 2009 03:52 Go to previous messageGo to next message
GuestUser32
Messages: 26
Registered: August 2009
Junior Member
Thanks for the answer

By the way I didnt repeat my question!!
There is a fault with the website as I said previously. I only created one topic and put one reply to a topic.
Sorry for the multiple replies and topics!!
Re: Constraints [message #431387 is a reply to message #431374] Tue, 17 November 2009 03:53 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Please - if it looks like your browsers hung, please check to see if the post happened before reposting!!!!
Re: Constraints [message #431389 is a reply to message #431386] Tue, 17 November 2009 03:56 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
GuestUser32 wrote on Tue, 17 November 2009 03:52

I only created one topic and put one reply to a topic.


Some times due the network it happens But With different topic(you entered two different topic names) name it`s not possible.

sriram Smile


Re: Constraints [message #431391 is a reply to message #431374] Tue, 17 November 2009 03:59 Go to previous messageGo to next message
GuestUser32
Messages: 26
Registered: August 2009
Junior Member
Well what I meant was I created one topic and the page hung, so I refreshed the page and the body reset back to blank aswell as the title so I just created a whole new topic again unaware that the other one had actually been created.
At the end of the day its not my fault!! This should be looked into as it will happen again to someone else.
Re: Constraints [message #431392 is a reply to message #431391] Tue, 17 November 2009 04:01 Go to previous messageGo to next message
ThomasG
Messages: 3185
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
You are very welcome to donate a faster server. Wink
Re: Constraints [message #431400 is a reply to message #431392] Tue, 17 November 2009 04:13 Go to previous messageGo to next message
pablolee
Messages: 2813
Registered: May 2007
Location: Scotland
Senior Member
ThomasG wrote on Tue, 17 November 2009 10:01
You are very welcome to donate a faster server. Wink

Very generous of you guestuser32. A monument will be erected in your honour Smile
Re: Constraints [message #431403 is a reply to message #431374] Tue, 17 November 2009 04:27 Go to previous messageGo to next message
GuestUser32
Messages: 26
Registered: August 2009
Junior Member
sorry I can't understand you, I dont speak English Razz
Re: Constraints [message #431411 is a reply to message #431391] Tue, 17 November 2009 04:50 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Quote:
At the end of the day its not my fault!! This should be looked into as it will happen again to someone else.


At the end of the day, you're the person who submitted the same question 6 times without checking that anything had been posted.

All we're asking is that you don't do it again.
That's it - nothing else.
Re: Constraints [message #431415 is a reply to message #431411] Tue, 17 November 2009 04:57 Go to previous messageGo to next message
GuestUser32
Messages: 26
Registered: August 2009
Junior Member
Quote:
At the end of the day, you're the person who submitted the same question 6 times without checking that anything had been posted.


hang on there me ol fruit!!

At the end of the day (i.e. who the blame should be pointed at) is the system not the fact that I reposted. I am sligtly to blame but the main focus should be on the system.

Anyway enough of this silly arguement.
Re: Constraints [message #431467 is a reply to message #431374] Tue, 17 November 2009 08:16 Go to previous messageGo to next message
joy_division
Messages: 4617
Registered: February 2005
Location: East Coast USA
Senior Member
Just to get back on track...Object names must be unique in a schema. Table names cannot have the same name as an index, constraint, procedure, etc. and vice versa.
Re: Constraints [message #431472 is a reply to message #431415] Tue, 17 November 2009 09:04 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Quote:
I am sligtly to blame but the main focus should be on the system.


<Pffft> A transparent attempt to avoid the heinous penalties for culpability in this matter.

I can't fix the server that hosts this board, but I can prod you with a (metaphorical) pointy stick.

Anyway - USER_CONSTRAINTS will show you everything in your schema, ALL_CONSTRAINTS will show you the constraints on all the objects in the database that you have privileges on, and DBA_CONSTRAINTS will (if you have the privileges required to see it) show you all the constraints in the DB.

Similarly named views exist for _TABLES, _INDEXES, _VIEWS, _OBJECTS, and many, many more.

Details on them can be found Here
Re: Constraints [message #431473 is a reply to message #431467] Tue, 17 November 2009 09:05 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Constraints can have the same names as indexes though.

Just to confuse matters.
Re: Constraints [message #431474 is a reply to message #431374] Tue, 17 November 2009 09:14 Go to previous messageGo to next message
GuestUser32
Messages: 26
Registered: August 2009
Junior Member
Thanks

I was able to find the constraint I was looking for.

Re: Constraints [message #431480 is a reply to message #431473] Tue, 17 November 2009 10:15 Go to previous messageGo to next message
Michel Cadot
Messages: 63810
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
JRowbottom wrote on Tue, 17 November 2009 16:05
Constraints can have the same names as indexes though.

Just to confuse matters.

And index name the same as a table name:
SQL> create table t (col integer);

Table created.

SQL> create index t on t(col);

Index created.

Regards
Michel

Re: Constraints [message #431501 is a reply to message #431480] Tue, 17 November 2009 13:07 Go to previous message
joy_division
Messages: 4617
Registered: February 2005
Location: East Coast USA
Senior Member
Heh, looks like I have been operating under some false assumptions. I wonder made me think that?
Previous Topic: I need a command to issue a command in sql
Next Topic: Bind Mismatch Issue
Goto Forum:
  


Current Time: Thu Sep 29 15:50:03 CDT 2016

Total time taken to generate the page: 0.07834 seconds