All Products
Search
Document Center

VSIZE

Last Updated: Jun 18, 2021

The VSIZE function returns the number of bytes for X.

Syntax

VSIZE(X)

Return type

The number of bytes for x is returned. If x is NULL, the function returns NULL.

Examples

To create the employees table and insert data to the table, execute the following statements:

CREATE TABLE employees(manager_id INT,last_name varchar(50),hiredate varchar(50),SALARY INT);
INSERT INTO employees VALUES(300, 'Wei',  '2019-09-11',23600);
INSERT INTO employees VALUES(200, 'Red', '2019-11-05', 23800);
INSERT INTO employees VALUES(100, 'Part',  '2018-10-01',24000);
INSERT INTO employees VALUES(200, 'Ross',  '2019-06-11',23500);
COMMIT;

To use the VSIZE function to query the number of bytes for manager_id = 300 in the last_name column, execute the following statement:

SELECT last_name, VSIZE (last_name) "BYTES" FROM employees WHERE manager_id = 300;

The following query result is returned:

+-----------+-------+
| LAST_NAME | BYTES |
+-----------+-------+
| Wei       |     3 |
+-----------+-------+