René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

vsize [Oracle SQL]

vsize(some-expression)
vsize is a function that returns the size of some-expression measured in bytes.
some-expression can also be a column name.
Size of a number:
select vsize(3.141) from dual;

VSIZE(3.141)
------------
           4
Size of a string:
select vsize('what is my size') from dual;

VSIZE('WHATISMYSIZE')
---------------------
                   15
Size of columns:
create table vsize_test (
  a number,
  b varchar2(10),
  c date
);

insert into vsize_test values (      1,'foo'   , sysdate      );
insert into vsize_test values (   1001,'aladin', sysdate-10000);
insert into vsize_test values (209.209, null   , sysdate+10000);
select vsize(a), vsize(b), vsize(c) from vsize_test;
  VSIZE(A)   VSIZE(B)   VSIZE(C)
---------- ---------- ----------
         2          3          7
         3          6          7
         5                     7