Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Attribute Level Constraint

Re: Attribute Level Constraint

From: Anurag Varma <avoracle_at_gmail.com>
Date: 23 Jun 2006 08:36:31 -0700
Message-ID: <1151076991.610725.171020@i40g2000cwc.googlegroups.com>

Khurram wrote:
> Anurag Varma wrote:
> > mytype(null,null) would result in a pointer to be placed in the table column Name
> > which would point to this (null,null) row. That is not the same as putting a null value
> >in the column.
>
> You mean to say column (NAME) would reference to MYTYPE OBJECT then why
> at the time of inserting NULL value it validates to column (NAME's)
> constraint why not the reference let it bypass?
>
> 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")
>
> But in case of LOB column it must be made non-null,that is,it must
> contain a locator,for
> that obligation empty_lob() is used but its not the same case with my
> scenario ,Perhaps
> i can acheive it by defining attribute level constraint ,but why?
>
>
> Thanx Anurag

ok .. I give up.
See if the official doco's explanation makes more sense to you:

http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96594/adobjbas.htm#454686

<quote>
A table column, object, object attribute, collection, or collection element is NULL if it has been initialized to NULL or has not been initialized at all. Usually, a NULL value is replaced by an actual value later on.

An object whose value is NULL is called atomically null. An atomically null object is different from one that simply happens to have null values for all its attributes. When all the attributes of an object are null, these attributes can still be changed, and the object's methods can be called. With an atomically null object, you can do neither of these things.
</quote>

Anurag Received on Fri Jun 23 2006 - 10:36:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US