Quick follow up
Doug, March 12, 2002 - 2:05 pm UTC
Is there anyway to specifiy alphanumeric ranges? Like [a-d]
or [a-z] to indicate an alphanumeric character?
March 12, 2002 - 4:58 pm UTC
escape character and nvarchar2
Andy, January 19, 2004 - 2:37 am UTC
Tom, I don't understand this behaviour with escape characters and nvarchar2 columns:
mires@linux2-l2ifag> create table y(vc varchar2(100), nvc nvarchar2(100));
Tabelle wurde angelegt.
mires@linux2-l2ifag> insert into y values ('ab/c', 'xy/z');
1 Zeile wurde erstellt.
mires@linux2-l2ifag> select count(*) from y where vc like 'ab//%' escape '/';
COUNT(*)
----------
1
mires@linux2-l2ifag> select count(*) from y where nvc like 'xy//%' escape '/';
select count(*) from y where nvc like 'xy//%' escape '/'
*
FEHLER in Zeile 1:
ORA-01425: Escape-Zeichen muss eine Zeichenfolge der Länge 1 sein
mires@linux2-l2ifag> select count(*) from y where nvc like 'xy//%' escape N'/';
COUNT(*)
----------
1
I've read in the 9i SQL reference that Oracle automatically converts my escape
character into the same data type as the column I am LIKE-ing, but why does that
mean that my escape character '/' is "lost", but N'/' isn't?
January 19, 2004 - 9:31 am UTC
not knowing your environment or anything -- makes things hard.
but -- to get a nchar characterstring constant -- you use N'constant', that is the way it works. if you want to use the nvarchar/nchar -- you'll be using n'x'.
same datatype -- wrong characterset is the problem in the above, '/' is not the same as n'/'
I think you want to stick with n' in all cases -- even on your like string.