Useful example when to use vsize function instead of length function in Oracle?

Vsize () and length () seem to return the same results. Does anyone know of a practical example of when to use vsize instead of length?

select vsize(object_name), length(object_name) from user_objects 

Result:

 /468ba408_LDAPHelper 20 20 /de807749_LDAPHelper 20 20 A4201_A4201_UK 14 14 A4201_PGM_FK_I 14 14 A4201_PHC_FK_I 14 14 
+4
source share
2 answers

Well, Length () takes a character argument (CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB), while VSize () accepts almost any data type, so if you pass Length () an uncharacteristic data type must be an implicit conversion.

Length is also sensitive to character sets.

 drop table daa_test; create table daa_test as select sysdate dt from dual; alter session set nls_date_format = 'YYYY-MM-DD'; select vsize(dt) from daa_test; select length(dt) from daa_test; alter session set nls_date_format = 'YYYY-MM-DD HH24:mi:ss'; select vsize(dt) from daa_test; select length(dt) from daa_test; 

... providing ...

 drop table daa_test succeeded. create table succeeded. alter session set succeeded. VSIZE(DT) ---------------------- 7 1 rows selected LENGTH(DT) ---------------------- 10 1 rows selected alter session set succeeded. VSIZE(DT) ---------------------- 7 1 rows selected LENGTH(DT) ---------------------- 19 1 rows selected 

VSize really uses IMHO to understand the internal requirements for data storage.

+5
source

All Articles