SQL>
SQL>
SQL> CREATE TABLE myTable (
2 Name VARCHAR(50) NOT NULL,
3 PhoneNo VARCHAR(15) DEFAULT 'Unknown Phone' NOT NULL
4 );
Table created.
SQL>
SQL> INSERT INTO myTable (Name, PhoneNo) VALUES ('Tom', '555 2323');
1 row created.
SQL> INSERT INTO myTable (Name) VALUES ('Tom');
1 row created.
SQL> INSERT INTO myTable (Name, PhoneNo) VALUES ('Tom', NULL);
INSERT INTO myTable (Name, PhoneNo) VALUES ('Tom', NULL)
*
ERROR at line 1:
ORA-01400: cannot insert NULL into ("JAVA2S"."MYTABLE"."PHONENO")
SQL>
SQL> DROP TABLE myTable;
Table dropped.
|