Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Usenet -> c.d.o.misc -> Re: Why? Oracle LONGVARCHAR Returning Wide Chars using ODBC "default" type

Re: Why? Oracle LONGVARCHAR Returning Wide Chars using ODBC "default" type

From: Nick Knight <>
Date: Thu, 21 Apr 2005 01:40:59 GMT
Message-ID: <4267043a$2$avpx$>

In <xx$p$>, on 04/20/2005

   at 08:25 AM, Jim Smith <> said:

>>I've got a couple of different versions of Oracle servers (8 & 9) running
>>in-house as test platforms. My software works very well with these via ODBC
>>connections. However, I've now hit my second install where LONGVARCHAR data
>>is coming back as wide characters - Unicode. I'm expecting single byte
>>ASCII; which is all I get from my machines.

>What version is the database with the problem? In 9 and 10 you can
>specify either CHAR or BYTE semantics for character-type columns. e.g.

>name varchar2(10 char) or
>name varchar2(10 byte).

>Byte is the default and is equivalent to ASCII.

Apparently it's a 9.2 setup. I managed to get a copy of the database today and, oddly, most of it worked Just Fine for me (how typical ... "works fine here!"). I did manage to recreate 1 specific problem, but there are others that remain a mystery. The mystery being why I don't see them.

My bad. As someone else pointed out, Oracle doesn't have a LONGVARCHAR type. My attempt at being "platform neutral". I use this type as a literal #define in coding (I think it maps directly to a SQL Server type) however, I translate this to "long" for Oracle.

Today I realized that, if I execute a simple select from a table that has nothing but an integer and a long column, I get correct results. For some reason, if I join to a table with an identical layout, I get Unicode text for the long column. Very odd, but at least I see that happening on my own machine. I believe I can fix this easily enough (but won't declare victory until I try it, tomorrow :).

Both tables are create via ODBC ExecDirect calls with SQL to Create table specifying the row simply as "long".

I solicited many ideas. I fiddled with ODBC settings. I played with the NLS_LANG settings for Oracle in the registry. I'm going to spend some time tomorrow using tighter types on my call to get the data.

I have a few issues not obviously related to Unicode, but having something to do with the use of long columns. Stay tuned, please, I'll describe these in a subsequent message.

Thanks for the reply,

Nick Received on Wed Apr 20 2005 - 20:40:59 CDT

Original text of this message