Oracle VSIZE() Function

Oracle VSIZE() is a built-in function that returns the number of bytes in the internal representation of the given expression.

Syntax of Oracle VSIZE()

Here is the syntax for the Oracle VSIZE() function:

VSIZE(expr)

Parameters

expr

Required.

Return Value

The Oracle VSIZE() function returns the number of bytes in the internal representation of the given expression.

The function does not directly support CLOB data. However, CLOBs can be passed as a parameter through implicit data conversion.

If any parameter is NULL, VSIZE() returns NULL.

Examples of Oracle VSIZE()

Here are some examples demonstrating the usage of the Oracle VSIZE() function.

Basic Usage

To return the number of bytes in the internal representation of the string 'ABC', use the following statement:

SELECT
    VSIZE('ABC')
FROM dual;

Output:

   VSIZE('ABC')
_______________
              3

Here is another example:

SELECT
    VSIZE('HI'),
    VSIZE('HELLO')
FROM dual;

Output:

   VSIZE('HI')    VSIZE('HELLO')
______________ _________________
             2                 5

NULL Parameter

If any parameter is NULL, VSIZE() returns NULL.

SET NULL 'NULL';
SELECT
    VSIZE(NULL)
FROM dual;

Output:

   VSIZE(NULL)
______________
          NULL

In this example, we use the statement SET NULL 'NULL'; to display the NULL value as the string 'NULL'.

Conclusion

Oracle VSIZE() is a built-in function that returns the number of bytes in the internal representation of the given expression.