Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Attribute Level Constraint
hi
As documented
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/clauses3a.htm
Restrictions on NOT NULL Constraints
-You cannot specify NULL or NOT NULL in a view constraint.
-You cannot specify NULL or NOT NULL for an attribute of an object.
Instead, use a CHECK
constraint with the IS [NOT] NULL condition.
Its ok You cannot specify NULL or NOT NULL for an attribute of an object
SQL> CREATE TYPE mtype AS OBJECT
(fname VARCHAR2(10) NOT NULL, lname VARCHAR2(10))
SQL> / Warning: Type created with compilation errors.
SQL> CREATE TYPE mytype AS OBJECT
(fname VARCHAR2(10), lname VARCHAR2(10))
SQL> CREATE TABLE t (id NUMBER,name MYTYPE NOT NULL);
Table created.
SQL> INSERT INTO t VALUES (1,mytype('KHURRAM','SIDDIQUI'));
1 row created.
SQL> INSERT INTO t VALUES (2,mytype('SHAHZAD',NULL));
1 row created.
SQL> INSERT INTO t VALUES (2,mytype(NULL,NULL));
1 row created.
SQL> SELECT id,e.name.fname,e.name.lname FROM t e;
ID NAME.FNAME NAME.LNAME
My question Why it is accepting NULL values though i have declared NOT
NULL to table
column name??
name MYTYPE NOT NULL
Khurram Received on Fri Jun 23 2006 - 05:21:31 CDT