Entering content frame

LENGTH(a) Locate the document in its SAP Library structure

LENGTH(a) is an arithmetic function that specifies the number of characters or bytes that are required to represent the expression a internally. The function can be applied to all data types (including LONG).

 

Result of the LENGTH(a) Function

a is a value of data type CHAR|VARCHAR <ASCII|UNICODE> with n characters

Number of characters n

a is a value of a different data type of length n

Length n in bytes

a is a NULL value

NULL value

a is a special NULL value

Special NULL value

The number of characters or the length in bytes is determined without taking into account any trailing blank characters (code attribute ASCII, UNICODE) or binary zeros (code attribute BYTE).

Example

SELECT name, LENGTH(name) mylength
FROM customer ORDER BY mylength, name

The customer table is sorted according to the length of the surnames, with names with the same length sorted in alphabetical order.

NAME

MYLENGTH

Doe

3

Howe

4

Baker

5

Brian

5

Brown

5

Smith

5

Miller

6

Peters

6

Porter

6

Jackson

7

Jenkins

7

Datasoft

8

Griffith

8

Randolph

8

TOOLware

8

 

 

Leaving content frame