I know that for the Oracle defined primary data type (like number, varchar2, date, timestamp) I can use select vsize(variable_name) from dual.
But how do I do for a variable of some user-defined type.
I can do something like the following:
declare
type tab_ch is table of varchar2(4000);
tb_ch tab_ch;
v_size number;
begin
tb_ch:=tab_ch('cuckoo', 'bau-wau','wysiswyg 8894983984983498jjsn');
v_size:=0;
for i in tb_ch.first..tb_ch.last loop
select v_size+vsize(tb_ch(i)) into v_size
from dual;
end loop;
dbms_output.put_line(v_size);
end;
/
But the above only gives the total size in memory of the components of a variable, while I think the variable itself takes more space in memory.
How to find the exact size in memory?