Problem with CAST of CLOB types.
Posted: Thu 24 Mar 2011 13:06
I have a table, Metadata, with the columns:
Name: VARCHAR2(50)
Value: CLOB
I try to execute the following Entity SQL query, where @p is an integer:
However, I get the exception with the message: ORA-00932: inconsistent datatypes: expected NUMBER got CLOB
I looked into dbMonitor, and I found that the resulting Oracle query was:
The problem is that a CLOB cannot be casted to NUMBER. It must be first casted to VARCHAR then to NUMBER. Following this logic, I tried the following Entity SQL query:
Which was successful, and resulted in the following Oracle query:
I get a similar error message when I try to CAST a CLOB to System.DateTime and System.DateTimeOffset.
I am using dotConnect for Oracle Professional 6.10.126.0.
Name: VARCHAR2(50)
Value: CLOB
I try to execute the following Entity SQL query, where @p is an integer:
Code: Select all
SELECT VALUE m FROM Metadata AS m WHERE m.Name = 'NumberValue' AND CAST(m.Value as System.Int32) > @pI looked into dbMonitor, and I found that the resulting Oracle query was:
Code: Select all
SELECT
"Extent1".WF_INSTANCE_ID AS WF_INSTANCE_ID,
"Extent1".NAME AS NAME,
"Extent1".VALUE AS VALUE,
"Extent1".SERIALIZED_VALUE AS SERIALIZED_VALUE
FROM METADATA "Extent1"
WHERE ("Extent1".NAME = 'NumberValue') AND ((CAST("Extent1".VALUE AS NUMBER)) > :p)Code: Select all
SELECT VALUE m FROM Metadata AS m WHERE m.Name = 'NumberValue' AND CAST(CAST(m.Value as System.String) as System.Int32) > @pCode: Select all
SELECT
"Extent1".WF_INSTANCE_ID AS WF_INSTANCE_ID,
"Extent1".NAME AS NAME,
"Extent1".VALUE AS VALUE,
"Extent1".SERIALIZED_VALUE AS SERIALIZED_VALUE
FROM METADATA "Extent1"
WHERE ("Extent1".NAME = 'NumberValue') AND ((CAST( TO_CHAR("Extent1".VALUE) AS NUMBER)) > :p)I am using dotConnect for Oracle Professional 6.10.126.0.