Consultor Eletrônico



Kbase P109604: LENGTH(<raw_expression>) returns the number of characters in <raw_expression> rather than bytes
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   03/04/2008
Status: Unverified

FACT(s) (Environment):

OpenEdge 10.x
All Supported Operating Systems

SYMPTOM(s):

Using LENGTH function with a RAW variable

LENGTH function returns the number of characters instead of the number of bytes

According to Progress Online Help, the LENGTH function "Returns the number of bytes in an expression of type RAW or a BLOB field."

Progress session started with -CPINTERNAL UTF-8

CAUSE:

The statement that the LENGTH function "Returns the number of bytes in an expression of type RAW or a BLOB field" appears to be incorrect. Rather the later statement that "By default unit of measurement is character units" is true for RAW expressions as well. In addition, the documentation implies that the TYPE option is only available for String expressions which is not the case.

FIX:

To return the number of bytes in a RAW expression, specify the TYPE with the LENGTH function:

LENGTH(<raw_expression>, "RAW")