The Database Design Resource Center

Superb article

by Shilpa
(India)

Really a superb article.

I don't understand why Oracle DDL for table creation, has kept the NULLABLE as the default for column definition,where as for NOT NULL, we have to put it explicitly, it should be other way round.

e.g. SQL> create table tbl(col1 NUMBER(10), col2 VARCHAR2(20) NOT NULL);

Table created.

SQL> insert into tbl values(10,'');
insert into tbl values(10,'')
*
ERROR at line 1:
ORA-01400: cannot insert NULL into ("REPOS_LAPTOP7"."TBL"."COL2")


SQL> insert into tbl values(,'to');
insert into tbl values(,'to')
*
ERROR at line 1:
ORA-00936: missing expression


SQL> insert into tbl values('','to');

1 row created.

SQL> commit;

Commit complete.

SQL> select count(col1) from tbl;

COUNT(COL1)
-----------
0

SQL> select count(col2) from tbl;

COUNT(COL2)
-----------
1

SQL>

Click here to post comments

Join in and write your own page! It's easy to do. How? Simply click here to return to On NULL values.


Exclusive interviews with:
Steven Feuerstein, PLSQL expert
Donald Burleson, Top IT consultant


Free eBook

Subscribe to my newsletter and get my ebook on Entity Relationship Modeling Principles as a free gift:


What visitors say...

"I just stumbled accross your site looking for some normalization theory and I have to say it is fantastic.

I have been in the database field for 10+ years and I have never before come across such a useful site. Thank you for taking the time to put this site together."

Mike, USA

Read more Testimonials

Database Normalization eBook:


Database Normalization eBook



Copyright © www.databasedesign-resource.com / Alf A. Pedersen
All rights reserved.
All information contained on this website is for informational purposes only.
Disclaimer: www.databasedesign-resource.com does not warrant any company, product, service or any content contained herein.

Return to top

Copyright acknowledgement note:

The name Oracle is a trademark of Oracle Corporation.
The names MS Access/MS SQL Server are trademarks of Microsoft Corporation.
Any other names used on this website may be trademarks of their respective owners, which I fully respect.