Home » SQL & PL/SQL » SQL & PL/SQL » Remove primary key (Oracle 10.2.0.4 on Solaris 10 )
Remove primary key [message #429253] Mon, 02 November 2009 16:11 Go to next message
Lucky A
Messages: 65
Registered: October 2007
Member
I want to remove the primary keys from specific tables on certain named columns. Also I want to drop the specific named columns from the table.
I will appreciate suggestions as to the best possible approach.


Thanks,

Lucky
Re: Remove primary key [message #429255 is a reply to message #429253] Mon, 02 November 2009 16:51 Go to previous messageGo to next message
BlackSwan
Messages: 24908
Registered: January 2009
Senior Member
ALTER SPECIFIC TABLE DROP CONSTRAINT PK_CERTAIN_NAMED_COLUMNS

Re: Remove primary key [message #429260 is a reply to message #429253] Mon, 02 November 2009 19:56 Go to previous messageGo to next message
Lucky A
Messages: 65
Registered: October 2007
Member
I am sorry for not being clear. How can I locate all of the Foreign keys and the columns they are referencing?
Re: Remove primary key [message #429261 is a reply to message #429260] Mon, 02 November 2009 20:20 Go to previous messageGo to next message
BlackSwan
Messages: 24908
Registered: January 2009
Senior Member
SQL> desc all_constraints
 Name					   Null?    Type
 ----------------------------------------- -------- ----------------------------
 OWNER					   NOT NULL VARCHAR2(30)
 CONSTRAINT_NAME			   NOT NULL VARCHAR2(30)
 CONSTRAINT_TYPE				    VARCHAR2(1)
 TABLE_NAME				   NOT NULL VARCHAR2(30)
 SEARCH_CONDITION				    LONG
 R_OWNER					    VARCHAR2(30)
 R_CONSTRAINT_NAME				    VARCHAR2(30)
 DELETE_RULE					    VARCHAR2(9)
 STATUS 					    VARCHAR2(8)
 DEFERRABLE					    VARCHAR2(14)
 DEFERRED					    VARCHAR2(9)
 VALIDATED					    VARCHAR2(13)
 GENERATED					    VARCHAR2(14)
 BAD						    VARCHAR2(3)
 RELY						    VARCHAR2(4)
 LAST_CHANGE					    DATE
 INDEX_OWNER					    VARCHAR2(30)
 INDEX_NAME					    VARCHAR2(30)
 INVALID					    VARCHAR2(7)
 VIEW_RELATED					    VARCHAR2(14)

SQL> desc all_cons_columns
 Name					   Null?    Type
 ----------------------------------------- -------- ----------------------------
 OWNER					   NOT NULL VARCHAR2(30)
 CONSTRAINT_NAME			   NOT NULL VARCHAR2(30)
 TABLE_NAME				   NOT NULL VARCHAR2(30)
 COLUMN_NAME					    VARCHAR2(4000)
 POSITION					    NUMBER
Re: Remove primary key [message #429666 is a reply to message #429253] Thu, 05 November 2009 02:08 Go to previous message
Lucky A
Messages: 65
Registered: October 2007
Member
Thanks for your input.
Previous Topic: help me on CURSOR
Next Topic: How to retrieve different data separated by comma into one column
Goto Forum:
  


Current Time: Tue Sep 27 16:06:29 CDT 2016

Total time taken to generate the page: 0.08042 seconds