RE: naming conventions (constraints and indexes)

From: Chitale, Hemant Krishnarao <Hemant.Chitale_at_sc.com>
Date: Thu, 10 Nov 2011 12:08:45 +0800
Message-ID: <716A5C2996468A419769E1DD3E12D07D1D729C_at_HKMGAXMB110A.zone1.scb.net>


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


http://hemantoracledba.blogspot.com/2010/07/preserving-index-when-dropping.html and
http://hemantoracledba.blogspot.com/2011/03/primary-key-and-index.html

 
Hemant K Chitale

-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Joel.Patterson_at_crowley.com Sent: Thursday, November 10, 2011 3:21 AM To: oracle-l_at_freelists.org
Subject: RE: naming conventions (constraints and indexes)

....deleted ....

CREATE TABLE EXAMPLE_TABLE (
  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';

TABLE_NAME                CONSTRAINT_NAME           C INDEX_NAME
------------------------- ------------------------- ------------------
EXAMPLE_TABLE             EXAMPLE_TABLE_PK          P EXAMPLE_TABLE_PX
EXAMPLE_TABLE             EXAMPLE_TABLE_UNIQ_COL_UK U EXAMPLE_TABLE_UNIQ_COL_UX

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

TABLE_NAME                     INDEX_NAME
------------------------------ ------------------------------
EXAMPLE_TABLE                  EXAMPLE_TABLE_PX
EXAMPLE_TABLE                  EXAMPLE_TABLE_UNIQ_COL_UX


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 http://www.standardchartered.com/global/email_disclaimer.html to refer to the information on other jurisdictions.

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Nov 09 2011 - 22:08:45 CST

Original text of this message