-
Expert Member
Vsize and length difference
What is the difference between vsize and length functions?
select vsize(sysdate) FROM DUAL;
select length(sysdate) FROM DUAL;
Why it is showing different size in the above example?
Last edited by krishnaindia2007; 12-08-2007 at 05:32 AM.
-
Expert Member
Re: Vsize and length difference
length returns the length of the string passed.
If string is a number, it first converts the number into a string and then returns its length.
As Oracle treats an empty string as null, the length of an empty string is also null.
select
length('hello world'),
length(42),
length(9.0),
length(10.1),
length(-8),
length('')
from
dual;
In Oracle/PLSQL, the vsize function returns the number of bytes in the internal representation of an expression.
vsize('Tech on the net') would return 15
vsize('Tech on the net ') would return 16
vsize(null) would return
vsize('') would return
vsize(' ') would return 1
select
vsize('hello world'),
vsize(42),
vsize(9.0),
vsize(10.1),
vsize(-8),
vsize('')
from dual
-
Re: Vsize and length difference
while length returns the length of the pased string , vsize function returns the number of bytes used to store tha data.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules