ORA-12704: character set mismatch error

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
mutoss
Posts: 2
Joined: Mon 07 Sep 2009 07:26

ORA-12704: character set mismatch error

Post by mutoss » Mon 07 Sep 2009 08:05

hi there,
i read the threads
http://www.devart.com/forums/viewtopic.php?t=15451
http://www.devart.com/forums/viewtopic.php?t=15536
and i downloaded the latest build of dotConnect for Oracle.
here is my ref pic=> http://i30.tinypic.com/fy28nl.jpg

so that's the situation:
i got 2 tables (1 base table, 1 inherited from the base)

CREATE TABLE REFERANS_MVC.BASESEGMENT
(
ID NUMBER,
CUSTOM_DATA VARCHAR2(100 BYTE),
IS_DELETED VARCHAR2(10 BYTE)
)
CREATE TABLE REFERANS_MVC.CUSTOMERSEGMENT
(
ID NUMBER NOT NULL,
NAME VARCHAR2(100 BYTE),
DESCRIPTION VARCHAR2(500 BYTE),
IDCODE NVARCHAR2(50),
VERSION NUMBER
)
referential integrity=>
ALTER TABLE REFERANS_MVC.CUSTOMERSEGMENT ADD (
CONSTRAINT CUSTOMERSEGMENT_R01
FOREIGN KEY (ID)
REFERENCES REFERANS_MVC.BASESEGMENT (ID));
2 ID columns are PKs.

i am using EF to persist data.
when i execute a query as follows i got no error.
CUSTOMERSEGMENT c = e.CreateQuery("[BASESEGMENT]").OfType().FirstOrDefault(p => p.ID == 10);
but when i omit ofType(that way we got an outer join), i got "ORA-12704: character set mismatch"
CUSTOMERSEGMENT c = e.CreateQuery("[BASESEGMENT]").FirstOrDefault(p => p.ID == 10);

the generated sqls are=>
with oftype=
SELECT
"Limit1".C1 AS C1,
"Limit1".ID AS ID,
"Limit1".CUSTOM_DATA AS CUSTOM_DATA,
"Limit1".IS_DELETED AS IS_DELETED,
"Limit1".NAME AS NAME,
"Limit1".DESCRIPTION AS DESCRIPTION,
"Limit1".IDCODE AS IDCODE,
"Limit1".VERSION AS VERSION
FROM ( SELECT
"Extent1".ID AS ID,
"Extent1".CUSTOM_DATA AS CUSTOM_DATA,
"Extent1".IS_DELETED AS IS_DELETED,
"Extent2".NAME AS NAME,
"Extent2".DESCRIPTION AS DESCRIPTION,
"Extent2".IDCODE AS IDCODE,
"Extent2".VERSION AS VERSION,
'0X0X' AS C1
FROM REFERANS_MVC.BASESEGMENT "Extent1"
INNER JOIN REFERANS_MVC.CUSTOMERSEGMENT "Extent2" ON "Extent1".ID = "Extent2".ID
WHERE 10 = "Extent1".ID AND ROWNUM <= (1)
) "Limit1"

without oftype=
Timestamp: 10:22:03.310
SELECT
"Limit1".C1 AS C1,
"Limit1".ID AS ID,
"Limit1".CUSTOM_DATA AS CUSTOM_DATA,
"Limit1".IS_DELETED AS IS_DELETED,
"Limit1".C2 AS C2,
"Limit1".C3 AS C3,
"Limit1".C4 AS C4,
"Limit1".C5 AS C5
FROM ( SELECT
"Extent1".ID AS ID,
"Extent1".CUSTOM_DATA AS CUSTOM_DATA,
"Extent1".IS_DELETED AS IS_DELETED,
CASE WHEN ( NOT (("Project1".C1 = 1) AND ("Project1".C1 IS NOT NULL))) THEN '0X' ELSE '0X0X' END AS C1,
CASE WHEN ( NOT (("Project1".C1 = 1) AND ("Project1".C1 IS NOT NULL))) THEN TO_CHAR(NULL) ELSE "Project1".NAME END AS C2,
CASE WHEN ( NOT (("Project1".C1 = 1) AND ("Project1".C1 IS NOT NULL))) THEN TO_CHAR(NULL) ELSE "Project1".DESCRIPTION END AS
C3,
CASE WHEN ( NOT (("Project1".C1 = 1) AND ("Project1".C1 IS NOT NULL))) THEN TO_CHAR(NULL) ELSE "Project1".IDCODE END AS C4,
CASE WHEN ( NOT (("Project1".C1 = 1) AND ("Project1".C1 IS NOT NULL))) THEN CAST(NULL AS NUMBER) ELSE "Project1".VERSION END
AS C5
FROM REFERANS_MVC.BASESEGMENT "Extent1"
LEFT OUTER JOIN (SELECT
"Extent2".ID AS ID,
"Extent2".NAME AS NAME,
"Extent2".DESCRIPTION AS DESCRIPTION,
"Extent2".IDCODE AS IDCODE,
"Extent2".VERSION AS VERSION,
1 AS C1
FROM REFERANS_MVC.CUSTOMERSEGMENT "Extent2" ) "Project1" ON "Extent1".ID = "Project1".ID
WHERE 10 = "Extent1".ID AND ROWNUM <= (1)
) "Limit1"
Runtime error occurred: 12704 (ORA-12704: character set mismatch)

the line CASE WHEN ( NOT (("Project1".C1 = 1) AND ("Project1".C1 IS NOT NULL))) THEN TO_CHAR(NULL) ELSE "Project1".IDCODE END AS C4 is causing the error. as you can see the column DESCRIPTION is not causing it, even if it is null, because of its ColumnType Varchar2. But IDCODE (NVarchar2) makes some trouble. TO_NCHAR makes the statement execute correctly.

Am i making an error or sth? any comments?

mutoss
Posts: 2
Joined: Mon 07 Sep 2009 07:26

ORA-12704: character set mismatch error

Post by mutoss » Tue 15 Sep 2009 07:03

similarly,

Entities entities = new Entities();
CUSTOMERSEGMENT customerSegment = entities.CreateQuery("[BASESEGMENT]").Where("it.IS_DELETED IS NULL").OfType().FirstOrDefault();

throw the {"ORA-12704: character set mismatch"} error.

CUSTOMERSEGMENT and BASESEGMENT are the same types as above.

fyi: i have run the same application using datadirect oracle adaptor and it works fine, could you please help me about the topic??

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 17 Sep 2009 11:36

The problem is associated with the fact that we were using typed NULLs.
This fact causes the problem you have described.
We have changed the default behaviour, the next build will contain untyped NULLs by design. This solution also has some disadvantages, but we will also add the Devart.Data.Oracle.Entity.OracleEntityProviderServices.TypedNulls property to control the behaviour.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 25 Sep 2009 07:29

The new build is available.

Post Reply