Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Character Set / Encrypted text question

Re: Character Set / Encrypted text question

From: Bjørn Engsig <>
Date: Thu, 06 Mar 2003 04:58:40 -0800
Message-ID: <>


The most frequent type of programming error leading to this is that the programmer expects that a varchar2 column can contain any binary value.  This is by definition not true, varchar2 (actually all char types, including clob and long) should ONLY be used to store readable text. If you want to store binary information, you need to use one of the RAW data types.

What you are seeing is probably that the database was created with one character set and your application runs with another. The database character set is set during 'create database' and can only be changed with difficulty if at all. The application character set is taken from the last part of the NLS_LANG environment. As an unfortunate side effect of the way Oracle does this, if both database and application character set is US7ASCII (which in any case is the worst possible), you can store any binary value and get it unchanged in to and out from the database. This fact has lead many to use varchar2 (or other char data types) to store binary values. This is not and never was supported, and cannot be expected to work.


Mark Richard wrote:

>Dear List,
>I have a question for the character set guru's out there...
>We are trying to store encrypted text from a Forte application into a
>varchar2 column in Oracle ( When Forte retrieves the string a
>couple of the characters appear to have changed value. I assume we are
>experiencing some kind of character set limitation. Does anyone have any
>ideas about how we might work around this issue? I have included the NLS
>section from out init.ora section for reference.
>The only workaround we can think of is converting the string to hex values
>and reassembling these into a long string and then storing that result.
>Does this sound reasonable (assuming it's not a simple character set
>Please keep the help simple - I have never had to be concerned with
>character sets before and don't really understand all of the terminology.
># NLS settings
>nls_date_format = "DD-MON-RRRR"
>nls_sort = BINARY
>nls_language = AMERICAN
>nls_numeric_characters = ".,"
>Thanks in advance,
> Privileged/Confidential information may be contained in this message.
> If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such person),
> you may not copy or deliver this message to anyone.
>In such case, you should destroy this message and kindly notify the sender
> by reply e-mail or by telephone on (61 3) 9612-6999.
> Please advise immediately if you or your employer does not consent to
> Internet e-mail for messages of this kind.
> Opinions, conclusions and other information in this message
> that do not relate to the official business of
> Transurban City Link Ltd
> shall be understood as neither given nor endorsed by it.

Bjørn Engsig, Miracle A/S
Member of Oak Table Network <> -

Please see the official ORACLE-L FAQ:
Author: =?ISO-8859-1?Q?Bj=F8rn_Engsig?=

Fat City Network Services    -- 858-538-5051
San Diego, California        -- Mailing list and web hosting services
To REMOVE yourself from this mailing list, send an E-Mail message
to: (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Mar 06 2003 - 06:58:40 CST

Original text of this message