Oracle® OLAP DML Reference 10g Release 2 (10.2) Part Number B14346-02 |
|
|
View PDF |
The NUMBYTES function counts the number of bytes in a text expression. When the value is a multiline text value, NUMBYTES returns the total number of bytes in all the lines. The result returned by NUMBYTES has the same dimensions as the specified expression.
Return Value
INTEGER
Syntax
NUMBYTES(text-expression)
Arguments
The TEXT
expression whose bytes are to be counted.
Examples
Example 20-33 Counting the Bytes in the Longest Name
You would like to know the length of the names of your products so you can specify the appropriate width for the label column in a report. You can use the NUMBYTES function in combination with the LARGEST function to find the length of the longest label. Then use that value to set the column size. The following statements in a program find the longest name and use the byte count to format a report.
firstcol = LARGEST(NUMBYTES(name.product))+1 LIMIT month TO FIRST 3 FOR product DO ROW WIDTH FIRSTCOL name.product WIDTH 6 ACROSS month - FIRST 3: units DOEND
When the program is run, it produces the following output.
3-Person Tents 200 203 269 Aluminum Canoes 347 400 482 Tennis Racquets 992 1,076 1,114 Warm-up Suits 1,096 1,214 1,294 Running Shoes 2,532 2,405 2,775