![]() |
|
DataNucleus Forum » List all forums » » Forum: Queries : JDOQL » » » Thread: Problem with queries on unicode fields in Oracle 10g » » » » Post: Problem with queries on unicode fields in Oracle 10g |
Print at Mar 12, 2010 6:07:25 AM |
| Posted by khomikh at Sep 4, 2006 7:26:07 AM |
|
Problem with queries on unicode fields in Oracle 10g Hi. I have a problem with queries on unicode fields in Oracle 10g. Queries work correct on this table: CREATE TABLE OE_ORGANIZATIONS_LOOKUP_NAMES ( ORGANIZATION_ID CHAR(36), ORDINAL_ID NUMBER(10), LOOKUP_NAME VARCHAR2(240) ) but don't work on this table: CREATE TABLE OE_ORGANIZATIONS_LOOKUP_NAMES ( ORGANIZATION_ID CHAR(36), ORDINAL_ID NUMBER(10), LOOKUP_NAME NVARCHAR2(240) ) I have received error: JDOQL Query : "SELECT count(this) FROM test.Organization WHERE this.lookupNames.contains(v_0) && v_0.matches(p_0) VARIABLES java.lang.String v_0 PARAMETERS java.lang.String p_0" SELECT COUNT(THIS.ID) FROM OE_ORGANIZATIONS THIS WHERE EXISTS (SELECT 1 FROM OE_ORGANIZATIONS_LOOKUP_NAMES THIS_LOOKUPNAMES_V_0 WHERE THIS_LOOKUPNAMES_V_0.ORGANIZATION_ID = THIS.ID AND THIS_LOOKUPNAMES_V_0.ORGANIZATION_ID = THIS.ID AND THIS_LOOKUPNAMES_V_0.LOOKUP_NAME LIKE <'company%'> ESCAPE '\' ) : ORA-01425: escape character must be character string of length 1 The following query works correct: SELECT COUNT(THIS.ID) FROM OE_ORGANIZATIONS THIS WHERE EXISTS (SELECT 1 FROM OE_ORGANIZATIONS_LOOKUP_NAMES THIS_LOOKUPNAMES_V_0 WHERE THIS_LOOKUPNAMES_V_0.ORGANIZATION_ID = THIS.ID AND THIS_LOOKUPNAMES_V_0.ORGANIZATION_ID = THIS.ID AND THIS_LOOKUPNAMES_V_0.LOOKUP_NAME LIKE 'company%' ESCAPE '\\' ) May be better use ESCAPE statement only when it is necessary (when match text contains SQL specific wildcard characters (in my case '%' and '_')). |
|
|
Current timezone is GMT Mar 12, 2010 6:07:25 AM |