Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Changing column format

RE: Changing column format

From: Burton, Laura L. <BurtonL_at_prismplus.com>
Date: Thu, 07 Nov 2002 12:59:30 -0800
Message-ID: <F001.004FE4B8.20021107125930@fatcity.com>

  1. Backup Table
  2. ALTER TABLE user DROP PRIMARY KEY CASCADE; This will drop the constraint and delete all foreign key relationships to userid.
  3. ALTER TABLE user ADD CONSTRAINT username_pk PRIMARY KEY (username) USING INDEX TABLESPACE USER_INDEX; This will create a new primary key constraint on username IF the username field is unique and does not contain nulls. The second line is optional.

Laura

-----Original Message-----
Sent: Thursday, November 07, 2002 2:34 PM To: Multiple recipients of list ORACLE-L

I create a table to store user account information and set "userid" column to be primary key. I now want to set "username" to be primary key instead of "userid", how do I change it? There are couple hundreds of records in table. Please advise.

Thanks,
David
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Nguyen, David M
  INET: david.m.nguyen_at_xo.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Burton, Laura L.
  INET: BurtonL_at_prismplus.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Nov 07 2002 - 14:59:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US