Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
类SQL通配符协助_Sql_Oracle - Fatal编程技术网

类SQL通配符协助

类SQL通配符协助,sql,oracle,Sql,Oracle,我需要你的帮助,我有一个简单的查询,但不知道如何相应地更改类似的通配符。此选项用于查询Oracle数据库 你能帮我做一下吗 select * from table_name where field1 like '1%' or field2 like '2%' or field3 like '3%' or field4 start with 4 but not 4123 以下是另一种方法: select * from table_name where substr (

我需要你的帮助,我有一个简单的查询,但不知道如何相应地更改类似的通配符。此选项用于查询Oracle数据库

你能帮我做一下吗

select * from table_name
where field1 like '1%'
    or field2 like '2%'
    or field3 like '3%'
    or field4 start with 4 but not 4123

以下是另一种方法:

select *
from table_name
where
  substr (field1, 1, 1) in ('1', '2', '3', '4') and
  field1 not like '4123%'

以下是另一种方法:

select *
from table_name
where
  substr (field1, 1, 1) in ('1', '2', '3', '4') and
  field1 not like '4123%'

谢谢你们的快速反应,谢谢你们的快速反应。