What is purpose of ENABLE keyword in a CREATE TABLE SQL statement?
When I check the DDL statement of an existing table in my Oracle database this is what I see
CREATE TABLE T_EVENTS ( EVENT_ID NUMBER(5) NOT NULL ,EVENT_TIMESTAMP DATE NOT NULL , EVENT_CATEGORY VARCHAR2(10) NOT NULL , EVENT_TYPE VARCHAR2(10) , EVENT_DESC VARCHAR2(200) , EVENTNUMBER(3) , CONSTRAINT T_EVENTS_PK PRIMARY KEY ( EVENT_ID , EVENT_TIMESTAMP ) ENABLE );
What does the ENABLE keyword mean in this DDL? I tried creating the table without ENABLE keyword and dont see any difference.
ENABLE is ON by default, so you don't have to explicitly specify it. It just clarifies that the constraint is enabled, this is the default, so it will work even if you dont specify.
The ENABLe keyword here enables the PRIMARY KEY constraint. Constraints are ON by default unless you turn them OFF with DISABLE keyword. You dont need to include ENABLE keyword in your statement, but doing so just provides more clarity, or maybe down to coding style.