我有两种用户类型:
create type TEST_TYPE_WITH_CHAR as table of varchar2(100 char);
create type TEST_TYPE_WITH_BYTE as table of varchar2(100 byte);
如何确定哪个类型包含char,哪个字节?
查看SYS.USER_COLL_TYPES
未提供此类信息。 sqlfiddle
答案 0 :(得分:2)
查看all_coll_types
视图。 Char_used
列,告诉您varchar2
元素的长度是以字节为单位还是字符仅存在于:
SQL> create type t_coll_type is table of varchar2(10 byte);
2 /
Type created
SQL>
SQL> select type_name
2 , elem_type_name
3 , char_used
4 from all_coll_types
5 where type_name = 'T_COLL_TYPE'
6 ;
TYPE_NAME ELEM_TYPE_NAME CHAR_USED
------------------------------ ------------------------------ ---------
T_COLL_TYPE VARCHAR2 B
SQL> create type t_coll_type2 is table of varchar2(10 char);
2 /
Type created
SQL>
SQL> select type_name
2 , elem_type_name
3 , char_used
4 from all_coll_types
5 where type_name = 'T_COLL_TYPE2'
6 ;
TYPE_NAME ELEM_TYPE_NAME CHAR_USED
------------------------------ ------------------------------ ---------
T_COLL_TYPE2 VARCHAR2 C