PL/SQL Question: How to Assign a CHAR variable to a NVARCHAR2 variable
Date: Thu, 7 Nov 2002 12:19:35 -0700
Message-ID: <8fxy9.332$CP2.59461_at_wagner.videotron.net>
I'm new to PL/SQL (Oracle 8i) and I need to convert a DATE variable to Text
into a NVARCHAR2.
I tried to write the following code function:
RETURN NVARCHAR2
AS
sDate NVARCHAR2(10);
BEGIN
sDate := TO_CHAR(TRUNC(SYSDATE), 'YYYY-MM-DD');
RETURN sDate;
END;
I recieved the following error when I compile:
PLS-00560: character set mismatch.
The NLS_LANG variable from the registry is AMERICAN_AMERICA.WE8ISO8859P1.
Is there another function in Oracle 8i to return the date as a NVARCHAR2 or is there a way to convert a CHAR to a NVARCHAR2. If not how can I convert from one character set to another (CAST and CONVERT doesn't seem to work).
PS: Its mandatory that the date is returned as a NVARCHAR2 in 'YYYY-MM-DD' format.