Re: VARRAW host variable into VARCHAR2 field

From: Scott Urman <surman_at_dlsun338.us.oracle.com>
Date: 1996/10/14
Message-ID: <53tssu$qan_at_inet-nntp-gw-1.us.oracle.com>#1/1


In article <325EDAA7.1689_at_cybercash.com>, "M. Shawkat Hasan" <hasan_at_cybercash.com> writes:
|> 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 ?

What you are doing is converting from RAW to a character type. Oracle will implicitly do a RAWTOHEX on the data. If you look at the VARCHAR2 column, you will see a hex representation of your data. This takes 2 characters for each byte (00 through FF) to represent all 256 values.

If you are storing the data in a VARRAW host variable, why not put it into a RAW column?

|>
|> 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.



Scott Urman Oracle Corporation surman_at_us.oracle.com

Author of _Oracle PL/SQL Programming_ ISBN 0-07-882176-2 Published by Oracle Press - http://www.osborne.com/oracle/index.htm

"The opinions expressed here are my own, and are not necessarily that of  Oracle Corporation"
Received on Mon Oct 14 1996 - 00:00:00 CEST

Original text of this message