似乎vsize()和length()返回相同的结果.有谁知道何时使用vsize而不是长度的实际例子?
select vsize(object_name), length(object_name) from user_objects
结果:
/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
David Aldrid.. 5
好吧,Length()接受一个字符参数(CHAR,VARCHAR2,NCHAR,NVARCHAR2,CLOB或NCLOB),而VSize()只接受任何数据类型,所以如果你传递一个非字符数据类型的Length(),那么必须有一个隐式转换.
长度对字符集也很敏感.
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;
......给...
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真正用于了解数据的内部存储要求.
好吧,Length()接受一个字符参数(CHAR,VARCHAR2,NCHAR,NVARCHAR2,CLOB或NCLOB),而VSize()只接受任何数据类型,所以如果你传递一个非字符数据类型的Length(),那么必须有一个隐式转换.
长度对字符集也很敏感.
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;
......给...
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真正用于了解数据的内部存储要求.