Sie sind auf Seite 1von 2

5/8/2015

DROPPING,DISABLINGandENABLINGUNIQUECONSTRAINTinOracleSQLPLSQLTechHoney

TECHHONEY
OAFramework

The#1Webs itefor O r ac lePL/SQ L,O AFr amew or k andH TML

DataBase

TechHoneysqlDROPPING,DISABLINGandENABLINGUNIQUECONSTRAINTinOracleSQLPLSQL
UNIQUECONSTRAINTinOracleSQLPLSQL

CHECKCONSTRAINTinOracleSQLPLSQL

DROPPING,DISABLINGandENABLINGUNIQUE
CONSTRAINTinOracleSQLPLSQL
InOracleSQL/PLSQLaUNIQUECONSTRAINTissingleorgroupofcolumn(s)/field(s)thatcanuniquely
identifyeachrecordinatable.

Categories
Attributes
clause
condition
function
HTML
Items
loop
OAFMiscellaneous

Someofthecolumn(s)/field(s)ofuniqueconstraintcanhaveNULLvaluesuntilthecombinationcanuniquely

Oracle

identifyeachrecordoftable.

PLSQLHowTo
plsql

ImportantpointsaboutUNIQUECONSTRAINTinOracleSQL/PLSQL:

Regions
sql

1. InOracleSQL/PLSQLaUNIQUECONSTRAINTcanbecreatedbyusingmaximumof32columns/fields.

statement

2. AUNIQUECONSTRAINTcanbedropped,disabledandenabledinALTERTABLEstatement.

Tags

SyntaxtoDROPaUNIQUECONSTRAINTinSQL/PLSQLis:
ALTERTABLEtable_name
DROPCONSTRAINTconstraint_name

RecentComments
techhoneyonFOREIGNKEYwithONDELETE

CASCADEinOracleSQLPLSQL
VaradSarveonFOREIGNKEYwithONDELETE

CASCADEinOracleSQLPLSQL
techhoneyonMessageLOVInputinOAF
badrionMessageLOVInputinOAF
techhoneyonFOREIGNKEYwithONDELETE

CASCADEinOracleSQLPLSQL

Example:

ALTERTABLEemployee
DROPCONSTRAINTemployee_pk

Theabovestatementwilldroptheuniqueconstraintemployee_pkfromtheemployeetable.

DisableaUNIQUECONSTRAINT.
Ifwedonotwishtodeletetheuniqueconstraintaswemayneedthesameinfuturebutforsometimewewantthe
uniqueconstraintnottofunction,thenwecandisabletheuniqueconstraint
SyntaxfordisablingtheuniqueconstraintinOracleSQL/PLSQLis:
ALTERTABLEtable_name
DISABLECONSTRAINTconstraint_name
Example:

http://www.techhoney.com/oracle/sql/droppingdisablingandenablinguniqueconstraintinoraclesqlplsql/

1/2

5/8/2015

DROPPING,DISABLINGandENABLINGUNIQUECONSTRAINTinOracleSQLPLSQLTechHoney

ALTERTABLEemployee
DISABLECONSTRAINTemployee_pk

HereintheaboveALTERstatementwehavedisabledtheUNIQUECONSTRAINTemployee_pkonthe
employeetable.

EnablingaUNIQUECONSTRAINT
Wecanenableauniqueconstraintthathasbeendisabledearlier,thesyntaxforenablingauniqueconstraintin
OracleSQL/PLSQLis:
ALTERTABLEtable_name
ENABLECONSTRAINTconstraint_name
Example:

ALTERTABLEemployee
ENABLECONSTRAINTemployee_pk

Hereintheabovestatementwehaveenabledtheuniqueconstraintemployee_pkinemployeetableusing
ALTERTABLEstatement.

Bookmarkthepermalink.

UNIQUECONSTRAINTinOracleSQLPLSQL

CHECKCONSTRAINTinOracleSQLPLSQL

DisclaimerSiteMap

TechHoney|PoweredbyMantra&WordPress.

http://www.techhoney.com/oracle/sql/droppingdisablingandenablinguniqueconstraintinoraclesqlplsql/

2/2

Das könnte Ihnen auch gefallen