oracle问题:select语句中如何实现sqlserver中得通配符查询?

coolicer 2001-10-15 01:35:46
比如在sqlserver中:
select * from mytable where col1 like 'firstname[_]lastname'
oracle中如何实现
...全文
112 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
sbm 2001-10-16
  • 打赏
  • 举报
回复
同意楼上的.
mashansj 2001-10-15
  • 打赏
  • 举报
回复
select * from mytable where name like 'zhang\_wei' escape '\';
szsusuia 2001-10-15
  • 打赏
  • 举报
回复
直接用:
select * from mytable where name like 'zhang_wei'; 不就行了。
coolicer 2001-10-15
  • 打赏
  • 举报
回复
我是说屏蔽通配符,比如
我要查找zhang_wei的名字
在sqlserver中
select * from mytable where name like 'zhang[_]wei'
而不是查找
zhang1wei,zhangkwei等等
dmyb7233 2001-10-15
  • 打赏
  • 举报
回复
Syntax

match_expression [NOT] LIKE pattern [ESCAPE escape_character]

Arguments

match_expression

Is any valid SQL Server expression of character string data type.

pattern

Is the pattern to search for in match_expression, and can include these valid SQL Server wildcard characters.

Wildcard character Description Example
% Any string of zero or more characters. WHERE title LIKE ?computer%?finds all book titles with the word 慶omputer?anywhere in the book title.
_ (underscore) Any single character. WHERE au_fname LIKE 慱ean?finds all four-letter first names that end with ean (Dean, Sean, and so on).
[ ] Any single character within the specified range ([a-f]) or set ([abcdef]). WHERE au_lname LIKE 慬C-P]arsen?finds author last names ending with arsen and beginning with any single character between C and P, for example Carsen, Larsen, Karsen, and so on.
[^] Any single character not within the specified range ([^a-f]) or set ([^abcdef]). WHERE au_lname LIKE 慸e[^l]%?all author last names beginning with de and where the following letter is not l.
KingSunSha 2001-10-15
  • 打赏
  • 举报
回复
ORACLE的通配符是%和_,前者可匹配多个字符,后者是一个.
和SQL SERVER一样的

2,598

社区成员

发帖
与我相关
我的任务
社区描述
Sybase相关技术讨论区
社区管理员
  • Sybase社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧