Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Attribute Level Constraint
Thanx andrew for yours coperation
> There is a subtle but real difference between NULL and mytype(NULL,NULL).??
Please would you tell me whats the diffrence between NULL and mytype
(NULL,NULL)??
SQL> CREATE TYPE mytype AS OBJECT
2 (fname VARCHAR2(10),
3 lname VARCHAR2(10))
4 .
SQL> /
Type created.
SQL> CREATE TABLE t (id NUMBER,name MYTYPE);
Table created.
SQL> ALTER TABLE t MODIFY (name CONSTRAINT t_name_nn NOT NULL);
Table altered.
SQL> INSERT INTO t VALUES (1,NULL);
INSERT INTO t VALUES (1,NULL)
*
ERROR at line 1:
ORA-01400: cannot insert NULL into ("SCOTT"."T"."NAME")
SQL> INSERT INTO t VALUES (1,mytype(NULL,NULL));
1 row created.
I am still confused why it let go (NULL,NULL) value while the attributes are masked by NOT NULL at the time of table creation?
Khurram Received on Fri Jun 23 2006 - 08:48:08 CDT
![]() |
![]() |