Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: substr, substrb and raw datatype

Re: substr, substrb and raw datatype

From: DA Morgan <damorgan_at_psoug.org>
Date: Tue, 14 Jun 2005 22:00:17 -0700
Message-ID: <1118811629.279545@yasure>


Rafal Dabrowa wrote:
> HansF wrote:
>

>> On Tue, 14 Jun 2005 20:34:57 +0200, Rafal Dabrowa interested us by
>>
>>> inconsistent with behavior of length/lengthb function pair.
>>> Both functions return the same value for raw fields.
>>
>>
>> Assuming your database/session is set to a single byte character set (and
>> assuming this will influence the results) length() and lengthb() should
>> provide the same result - one character = one byte.

>
>
> But, for a 10-byte RAW value, both length and lengthb return 20.
> Although, lengthb works on a byte-oriented string, like
> substrb does. So, if substrb does not perform a conversion,
> lengthb shouldn't, too. If lengthb wouldn't perform a
> conversion, it would return 10, not 20.

Look at my example again. VARCHAR2 stores 65,66,67 for 'ABC'. Substringing can return 65,66 and you get 'AB'. What are you going to get, if you substring 10,188 which is the representation in RAW?

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Wed Jun 15 2005 - 00:00:17 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US