Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Converting varchar to nvarchar

Converting varchar to nvarchar

From: <barx_at_my-deja.com>
Date: Tue, 17 Oct 2000 01:29:38 GMT
Message-ID: <8sga1s$hq7$1@nnrp1.deja.com>

Greetings,

I am using Oracle 8.1.5 with a database that we have changed the compatibility level to 8.0.5 (for our client's version).

I face a problem, which shouldn't seem to hard to fix but I can't seem to figure it out.

I wish to store an identifier (PK) in a nvarchar2(12) field. To create this identifier, I need to append a code (also a nvarchar2) to a sequence number(an Oracle sequence). My sequence works fine on its own if the column is a varchar2 but if it is a nvarchar2, I get a character mismatch (as expected. If I concatenate the code (nvarchar2) to the sequence number it implicitly converts it to a varchar2.

I have tried to explicitly convert the sequence number to an nvarchar2 using the following statement (in the insert clause)

..INSERT....VALUES (TO_CHAR(MarsSeq.NextVal, '000000009', 'UTF8'), .....

...this only results in a character mismatch as well.

I have tried converting the code and the sequence number in different ways before concatenating them, but I can't seem to get it right.

Does anybody have any suggesting or have come across this before??

Any help is greatly appreciated.

Regards
barx

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Oct 16 2000 - 20:29:38 CDT

Original text of this message

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