Oracle version:
Sql> select * from V$version;
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.6.0-production
Pl/sql Release 9.2.0.6.0-production
CORE 9.2.0.6.0 Production
TNS for 32-bit windows:version 9.2.0.6.0-production
Nlsrtl Version 9.2.0.6.0-production
****************************************************************
* * When you create a primary key for a table, if you do not specify a primary key name, Oracle automatically generates a PRIMARY key constraint with a name similar to "sys_c00421221."
* * Also, generate a primary key index with the same name. The following query:
sql> COL constraint name FORMAT A13
sql> COL Constraint type FORMAT A8
sql> COL table name FORMAT A4
sql> COL naming Format A14
Sql> COL index name FORMAT A13
sql> SELECT constraint_name constraint name, constraint_type constraint type, table_name table name, generated naming method, index_name index name
2 from User_constraints
3 WHERE table_name = ' PC59 ' and constraint_type = ' P ';
Constraint name constraint type table name naming method index name
------------- -------- ---- -------------- -------------
sys_c00421221 P PC59 generated NAME sys_c00421221
****************************************************************
* * If you want to rename a primary key constraint and a primary key index, you can use the following methods:
sql> ALTER TABLE pc59 RENAME CONSTRAINT sys_c00421221 to pk_pc59;
Table Altered
sql> ALTER INDEX sys_c00421221 RENAME to pk_pc59;
Index Altered
****************************************************************
* * Requery the database view to see that both the primary KEY constraint and the name of the primary key index have changed.
* * But the naming method has not changed.
* * If you specify a name when you generate a primary key for the table, the naming is user name, otherwise generated name.
sql> COL constraint name FORMAT A13
sql> COL Constraint type FORMAT A8
sql> COL table name FORMAT A4
sql> COL naming Format A14
Sql> COL index name FORMAT A13
sql> SELECT constraint_name constraint name, constraint_type constraint type, table_name table name, generated naming method, index_name index name
2 from User_constraints
3 WHERE table_name = ' PC59 ' and constraint_type = ' P ';
Constraint name constraint type table name naming method index name
------------- -------- ---- -------------- -------------
pk_pc59 P PC59 generated NAME pk_pc59