RE: naming conventions (constraints and indexes)

From: <>
Date: Thu, 10 Nov 2011 09:09:06 -0500
Message-ID: <>

Interesting, and I have a couple observations from these urls.
  • Yes, the ALTER TABLE ... DROP CONSTRAINT does have a "KEEP INDEX" clause.
  • Hemant gives an example of the index and constraint name being different, but that when you drop the constraint, the ORA-0001 returns the index name. However, I interpret the results where, when they are the same name, that the index name is still returned... since the constraint was dropped, why would it be the constraint name, (they're the same -- I say it is the index name still).

I'm just not too sure how much it matters that the index be independent of the constraint. Indeed it seems like a good idea ... However, Freek points out that the using index clause has a side affect where if another index is present that can support the constraint, then oracle will not recreate the one defined in the using index clause during import. (kind of news to me though -- but it seems like almost a redundant index situation).

Joel Patterson
Database Administrator
904 727-2546

-----Original Message-----

From: Chitale, Hemant Krishnarao [] Sent: Wednesday, November 09, 2011 11:09 PM To: Patterson, Joel
Subject: RE: naming conventions (constraints and indexes)

I prefer to create the Index *before* defining the constraint. That way, the Index is independent of the constraint. So

a) the Index is preserved when I drop the constraint
b) the Index can be non-Unique 
c) for composite definitions, the columns need not be in the same "order" in the Index definition and

Hemant K Chitale

-----Original Message-----

From: [] On Behalf Of Sent: Thursday, November 10, 2011 3:21 AM To:
Subject: RE: naming conventions (constraints and indexes)

....deleted ....

  PRIM_COL number constraint EXAMPLE_TABLE_PK primary key     using index ( CREATE INDEX EXAMPLE_TABLE_PX ON       EXAMPLE_TABLE(PRIM_COL)),
  UNIQ_COL number constraint EXAMPLE_TABLE_UNIQ_COL_UK UNIQUE     using index ( create index EXAMPLE_TABLE_UNIQ_COL_UX on       EXAMPLE_TABLE(UNIQ_COL)),
  junk varchar2(10)

select table_name, constraint_name, constraint_type, index_name

      from user_constraints where table_name = 'EXAMPLE_TABLE';


------------------------- ------------------------- ------------------

DBMON _at_ COSDEV> select table_name, index_name from user_indexes where table_name = 'EXAMPLE_TABL

TABLE_NAME                     INDEX_NAME

------------------------------ ------------------------------

Joel Patterson
Database Administrator
904 727-2546

This email and any attachments are confidential and may also be privileged. If you are not the addressee, do not disclose, copy, circulate or in any other way use or rely on the information contained in this email or any attachments. If received in error, notify the sender immediately and delete this email and any attachments from your system. Emails cannot be guaranteed to be secure or error free as the message and any attachments could be intercepted, corrupted, lost, delayed, incomplete or amended. Standard Chartered PLC and its subsidiaries do not accept liability for damage caused by this email or any attachments and may monitor email traffic.

Standard Chartered PLC is incorporated in England with limited liability under company number 966425 and has its registered office at 1 Aldermanbury Square, London, EC2V 7SB.

Standard Chartered Bank ("SCB") is incorporated in England with limited liability by Royal Charter 1853, under reference ZC18. The Principal Office of SCB is situated in England at 1 Aldermanbury Square, London EC2V 7SB. In the United Kingdom, SCB is authorised and regulated by the Financial Services Authority under FSA register number 114276.

If you are receiving this email from SCB outside the UK, please click to refer to the information on other jurisdictions.
-- Received on Thu Nov 10 2011 - 08:09:06 CST

Original text of this message