Entering content frame

Background documentation Binary Strings Locate the document in its SAP Library structure

Analogous to character strings, Open SQL supports three types to store varying length binary strings: VARBINARY, LONGVARBINARY and BLOB. Only columns of the VARBINARY type whose size is limited to 255 bytes are comparable, whereas LONGVARBINARY and BLOB columns are not.

From a functional point of view, LONGVARBINARY and BLOB columns behave the same, but the size restriction imposed on the LONGVARBINARY type allows this type to be mapped to an appropriate VARBINARY type on each supported database platform. On most database platforms, this type is more efficient than the respective BLOB type.

To store binary strings with more than 2,000 bytes, the BLOB type has to be used.

Because the comparison semantics of binary strings differs considerably on the various database platforms, the portability of VARBINARY comparisons can only be guaranteed if both operands have equal lengths. A further restriction imposed by Open SQL’s portability paradigm is that empty (zero-length) binary strings cannot be stored in any of these column types, because on some database platforms the empty string is always treated as a NULL value. If you need to represent something like an "initial" value, you should either use some outstanding value in accordance with your application or consider storing a NULL value explicitly. In the latter case, you should be aware of the NULL value handling in SQL comparisons.

 

See also:

Using LOBs

Leaving content frame