我在oracle9i中打算用转义字符,可是碰到了奇怪的问题请教一下:问题如下:
我使用
select * from t_photo where tph_memo like '%\_%' ESCAPE '\';的时候提示
错误ORA-01425,可是明明是一个字符呀。
然后我换成
select * from t_photo where tph_memo like '%\\%%' ESCAPE '\\';就不提示错误了
可是查询结果不正确,不能查出任何数据。请大虾帮忙解释一下?我的数据库安装的时候
使用的是unicode32,我怀疑是不是和这个有关系。请问如何才能解决。
我使用
select * from t_photo where tph_memo like '%\_%' ESCAPE '\';的时候提示
错误ORA-01425,可是明明是一个字符呀。
然后我换成
select * from t_photo where tph_memo like '%\\%%' ESCAPE '\\';就不提示错误了
可是查询结果不正确,不能查出任何数据。请大虾帮忙解释一下?我的数据库安装的时候
使用的是unicode32,我怀疑是不是和这个有关系。请问如何才能解决。
select * from t_photo where tph_memo like '%#_%' ESCAPE '#';
select * from t_photo where instr(tph_memo,'_') >0;
select * from t_photo where tph_memo like '%' || chr(0) || '_%' escape chr(0);
比如"&"等
用select * from t_photo where instr(tph_memo,'_') >0
倒是可以实现,但是需要改动的地方太多了,希望还是可以能
使用like关键字。请问还有其它的方法吗?是否和数据库安装
的时候选择的编码有关系?
select * from t_photo where tph_memo like '%\%%' escape chr(92 USING NCHAR_CS);
可以实现了