Deletes one or more constraint definitions. When the DELETE
CONSTRAINT statement executes, Oracle Rdb deletes the constraint
definition from the physical database. If you use the PATHNAME
argument when you invoke the database, DELETE CONSTRAINT also
deletes the constraint definition from the data dictionary.
You cannot delete a constraint when there are active transactions
that access the relation or relations involved.
You must execute this statement in a read/write transaction.
If there is no active transaction and you issue this statement,
Oracle Rdb starts a read/write transaction implicitly.
You cannot delete a constraint definition unless you have invoked
the database that includes the constraint. Other users are
allowed to be attached to the database when you issue the DELETE
CONSTRAINT statement.
Example:
DELETE CONSTRAINT EMPLOYEE_ID_EXISTS.
1 – Format
(B)0[m[4mDELETE[m [4mCONSTRAINT[m qqwqq> constraint-name qqwqq> .
mqqqqq<qqq , qqqq<qqqqqj
1.1 – constraint-name
The name of the constraint definition you want to delete.
2 – Examples
Example 1
The following example deletes a single constraint definition:
INVOKE DATABASE PATHNAME 'PERSONNEL'
DELETE CONSTRAINT EMP_NUM_CON.
This statement deletes EMP_NUM_CON from the physical database and
the data dictionary.
Example 2
You can also delete more than one constraint definition at once:
INVOKE DATABASE FILENAME 'PERSONNEL'
DELETE CONSTRAINT SAL_CON,SS_NUM_CON.
This statement deletes the two constraint definitions from the
physical database.
3 – More
To delete a constraint, you must have the Oracle Rdb READ privilege
to the database and the Oracle Rdb DELETE privilege to all relations
to which the constraint refers.