Can anybody coment the following results:
SQL> select dump('abc') from dual;
DUMP('ABC')
----------------------
Typ=96 Len=3: 97,98,99
SQL> select dump(trim('abc')) from dual;
DUMP(TRIM('ABC'))
---------------------
Typ=1 Len=3: 97,98,99
SQL> select dump(a) from
(select 'abc' a from dual
union all
select trim('abc') a from dual)
DUMP(A)
--------------------------------------------------------------------------------
Typ=1 Len=3: 97,98,99
Typ=1 Len=3: 97,98,99
Moreover,
SQL> select dump(a) from
(select 'abc' a from dual
union all
select 'abcde' a from dual)
DUMP(A)
--------------------------------------------------------------------------------
Typ=1 Len=3: 97,98,99
Typ=1 Len=5: 97,98,99,100,101
Obviously, trim() returns ARCHAR2 and string literal is treated as CHAR, so the results of 2 first queries are predictable. But the third one is a bit strange: the field is not casted to the type in the first subquery. So it seems that all strings of different subtypes (lengths) are casted to varchar2. Can anybody provide some official source to prove or refute it?
Regards, Dima
SQL> select dump('abc') from dual;
DUMP('ABC')
----------------------
Typ=96 Len=3: 97,98,99
SQL> select dump(trim('abc')) from dual;
DUMP(TRIM('ABC'))
---------------------
Typ=1 Len=3: 97,98,99
SQL> select dump(a) from
(select 'abc' a from dual
union all
select trim('abc') a from dual)
DUMP(A)
--------------------------------------------------------------------------------
Typ=1 Len=3: 97,98,99
Typ=1 Len=3: 97,98,99
Moreover,
SQL> select dump(a) from
(select 'abc' a from dual
union all
select 'abcde' a from dual)
DUMP(A)
--------------------------------------------------------------------------------
Typ=1 Len=3: 97,98,99
Typ=1 Len=5: 97,98,99,100,101
Obviously, trim() returns ARCHAR2 and string literal is treated as CHAR, so the results of 2 first queries are predictable. But the third one is a bit strange: the field is not casted to the type in the first subquery. So it seems that all strings of different subtypes (lengths) are casted to varchar2. Can anybody provide some official source to prove or refute it?
Regards, Dima