Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Cannot insert '' into NOT NULL column
It's best to not have nulls as part of your PK- that's why they're not
allowed. If null is a valid value for part of your PK, then your design is
probably wrong, but that's okay, just substitute null with something else,
as you suspected. Be sure to use the same "something else" each time you
would use a null.
This will work, but will not get you a good grade in class.
"x" <x_at_x.hr> wrote in message news:c3ck4s$m1$1_at_ls219.htnet.hr...
>
> "D. Alvarado" <laredotornado_at_zipmail.com> wrote in message
> news:9fe1f2ad.0403180749.53a2a394_at_posting.google.com...
> > Hello,
> > I'm running Oracle 8.1.7 for Solaris. I have a situation where I
> > want my primary key to potentially include a '' value. However, it
> > appears Oracle treats '' the same as NULL, and of course, NULLs are
> > not allowed in primary keys. Is there anything I can do to allow the
> > oclumn to have a '' value AND index the column in some way? Or is the
> > only solution to hard code into my application that if inserting a '',
> > change it to something non-empty before the insert occurs?
> >
> > Thanks - Dave
>
> It's better to use before insert trigger to do that.
>
>
Received on Thu Mar 18 2004 - 12:45:29 CST