Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to insert an empty string (zero-length) a non-nullable VarChar2 column

425313Jul 13 2004 — edited Nov 4 2006
All--

Please help.

How can one insert an empty string (that is, a zero-length string) a non-nullable VarChar2 column?

That is, in C# for example, I want to insert this...

string myValue = "";

...into an Oracle column that is VarChar2 but not nullable.

When I try, Oracle complains that I cannot insert null into the column.

(FYI, I am using C# and ODP.NET and Oracle 9i.)

Right now, I am simply inserting a single space as a workaround, which seems rather crazy.

(Note that SQL Server 2000 will allow one to insert "" into a non-nullable column; so, I am wondering why Oracle does not.)

(Note that in this application, I cannot use nulls.)

What is the best way of handling this situation?

Please advise.

Thank you.

--Mark



Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 2 2006
Added on Jul 13 2004
8 comments
41,327 views