We use Oracle 10g
and Oracle 11g
.
We also have a layer to automatically compose queries, from pseudo-SQL code written in .net (something like SqlAlchemy for Python).
Our layer currently wraps any string in single quotes '
and, if contains non-ANSI characters, it automatically compose the UNISTR
with special characters written as unicode bytes (like \00E0
).
Now we created a method for doing multiple inserts with the following construct:
INSERT INTO ... (...)
SELECT ... FROM DUAL
UNION ALL SELECT ... FROM DUAL
...
This algorithm could compose queries where the same string field is sometimes passed as 'my simple string'
and sometimes wrapped as UNISTR('my string with special chars like \00E0')
.
The described condition causes a ORA-12704: character set mismatch
.
One solution is to use the INSERT ALL
construct but it is very slow compared to the one used now.
Another solution is to instruct our layer to put N
in front of any string (except for the ones already wrapped with UNISTR
). This is simple.
I just want to know if this could cause any side-effect on existing queries.
Note: all our fields on DB are either NCHAR
or NVARCHAR2
.
Oracle ref: http://docs.oracle.com/cd/B19306_01/server.102/b14225/ch7progrunicode.htm