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: Jim Kennedy <kennedy-downwithspammersfamily_at_attbi.net>
Date: Tue, 14 Jun 2005 19:59:36 -0700
Message-ID: <X7SdnRQBmejCBDLfRVn-qA@comcast.com>

"HansF" <News.Hans_at_telus.net> wrote in message news:pan.2005.06.14.17.43.49.201288_at_telus.net...
> On Tue, 14 Jun 2005 17:14:23 +0200, Rafal Dabrowa interested us by
> writing:
>
> > I have noticed that a column with "raw" datatype may be passed to
> > substr and substrb functions instead of char table. But, despite
> > Oracle documentation says that the functions are the same for
> > single-byte database character set, these functions behave
> > differently with raw column type.
> >
>
> The Oracle documentation also says:
>
> "
> SUBSTR calculates lengths using characters as defined by the input
> character set. SUBSTRB uses bytes instead of characters.
> "
>
> SUBSTRB does the substring at BYTE boundaries. SUBSTR does the operation
> at CHAR boundaries
>
> Now, in the Concepts manual, it states
>
> "
> The RAW and LONG RAW datatypes are used for data that is not to be
> interpreted (not converted when moving data between different systems) by
> Oracle. These datatypes are intended for binary data or byte strings.
> "
>
> If the data is not to be interpreted, then where is the character bundary
> for SUBSTR to use? Elsewhere in the Concepts manual we read
>
> "
> When Oracle automatically converts RAW or LONG RAW data to and from CHAR
> data, the binary data is represented in hexadecimal form with one
> hexadecimal character representing every four bits of RAW data. For
> example, one byte of RAW data with bits 11001011 is displayed and entered
> as 'CB.'
> "
>
> which implies the operation may be nibble-oriented. This seems
> consistent with your findings.
>
> But, one may ask WHY you are doing character-based substrings of binary
> data? (Rhetorical question <g>)
>
> --
> Hans Forbrich
> Canada-wide Oracle training and consulting
> mailto: Fuzzy.GreyBeard_at_gmail.com
> *** I no longer assist with top-posted newsgroup queries ***

Good point I know a vendor that uses varchar fields in Oracle to store raw data. Means the server and the client must be the same OS. Stupid. Jim Received on Tue Jun 14 2005 - 21:59:36 CDT

Original text of this message

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