Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/75.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 删除字符串开头的所有字符,直到Oracle中的某个字符_Sql_Oracle - Fatal编程技术网

Sql 删除字符串开头的所有字符,直到Oracle中的某个字符

Sql 删除字符串开头的所有字符,直到Oracle中的某个字符,sql,oracle,Sql,Oracle,我有一个地址字段,其中我只想提取城市和州。数据按如下方式存储:(1234 Cherry ST_Sometown ST)。我想删除包括第一个下划线在内的所有内容。使用REGEXP\u REPLACE() 到目前为止,我唯一发现的是能够删除第n个数字 试试这个 select substr(address, instr(address, '_') + 1, length(address)) as "CityState" from address 试试regexp_instr。这将为您定位u,使用子

我有一个地址字段,其中我只想提取城市和州。数据按如下方式存储:(1234 Cherry ST_Sometown ST)。我想删除包括第一个下划线在内的所有内容。使用
REGEXP\u REPLACE()

到目前为止,我唯一发现的是能够删除第n个数字

试试这个

select substr(address, instr(address, '_') + 1, length(address)) as "CityState"
from address

试试regexp_instr。这将为您定位u,使用子字符串函数仅选择该字符位置的信息。Oracle.com链接: