Re: VARRAW host variable into VARCHAR2 field

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/10/13
Message-ID: <3260e348.1599750_at_dcsun4>#1/1


whenever a conversion from RAW to CHAR (varchar or char) takes place, the RAW data will be converted to HEX.

whenever a conversion from CHAR (varchar or char) takes place, the CHAR data will be considered to be HEX characters and converted.

sort of like (well, exactly like) storing a number in a varchar2. The conversion from NUMBER to CHAR will succeed as along as the CHAR field is big enough to hold the number, decimal place and sign. the conversion from CHAR to number will succeed if the char string is in fact a number (just like the CHAR to RAW conversion will succeed if the CHAR string contained only 0-9A-F hex codes...)

So yes, a varchar must be 2x the size of the raw to hold the hex characters.

On Fri, 11 Oct 1996 23:39:19 +0000, "M. Shawkat Hasan" <hasan_at_cybercash.com> wrote:

>In a Pro*C program I define a VARRAW type equivalence by reference
>and insert data into a varchar2 field through this VARRAW variable.
>The problem is, to be successful, the VARCHAR2 data field length
>has to at least twice the length of the length of the inserted
>VARRAW variable.
>
>My question: Is it normal ? does ORACLE translate VARRAW data to
>twice its specified length (in var->len) when storing in a VARCHAR2
>field ?
>
>I'd appreciate if anybody knaow anything about this situation. Please
>email me a copy of the response. Thanks,
>
>-- Hasan.
>
>Desclaimer: My opinions are mine only, not my employer's.

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com

  • Check out Oracle Governments web site! ----- Follow the link to "Tech Center" and then downloadable Utilities for some free software...

statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Sun Oct 13 1996 - 00:00:00 CEST

Original text of this message