Skip to Content

Assigning Empty Strings to String Field Throws OpenSQLException

Hi there,

I have defined a DB table with different fields, one of these is field COMMENT, type set to string, Dim to 1024, that means real type Varchar (when controlling via SQL Studio; within the DDIC Project in Netweaver Developer Studio, it says LONGVARCHAR for being bigger than 1000 chars), code is UNICODE, Not Null not set.

When I insert a row and there is no comment, an empty string is set for COMMENT. But this throws a Cannot assign an empty string to host variable

Why this?

When I control the string before and set the field to null instead of the empty string, it "works". (But that's definitely ugly).

Thanks in advance


Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on May 20, 2004 at 09:15 AM

    Hi Detlev,

    For portability reasons Open SQL does not allow for storing empty strings in VARCHAR, LONGVARCHAR, or CLOB columns.

    Best regards,


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Zornitsa,

      ok, so far, but I have some problems to understand why the conversion from an empty string to NULL ist not done by OpenSQL. If I have no possibility to store an empty string as an empty string, why not converting it within OpenSQL? If this is documented, everybody knows this and could react if he/she wants another reaction on empty strings, but the normal way will be to store empty strings as NULL, if I cannot store them as empty strings. With the situation as it is now, one million OpenSQL developers 😉 are converting empty strings to NULL. Hm, not so nice...

      Best regards