Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle NOT NULL Constraint

In Oracle, NOT NULL constraint forces the column to always accept a value. Using NOT NULL constraint you can make sure a column cannot have a NULL value. The Oracle NOT NULL constraints are inline constraints which are typically used in the column definition of the CREATE TABLE statement.

Oracle NOT NULL Constraint example

The following Oracle, enforces column "custId", firstName", "lastName" and "address" to NOT to accept NULL values:

Example

CREATE TABLE tblCustomer (
    custId int NOT NULL,
    firstName varchar(255) NOT NULL,
    lastName varchar(255) NOT NULL,
    address varchar(255) NOT NULL
);

Note:

In the above example, we are creating new table called "tblCustomer" using NOT NULL constraint. The NOT NULL constraint enforces column "custId", firstName", "lastName" and "address" to NOT to accept NULL values.