楼上的计算方式可以,也可以用正则with tmp as (select '16_4253116201_3600*1*4' as p_str from dual) select regexp_substr(tmp.p_str, '[^_]+', 1, regexp_count(tmp.p_str, '[^_]+')) from tmp;
可以这样写, 不需要用count了 WITH TMP AS (SELECT '16_4253116201_3600*1*4' AS P_STR FROM DUAL) SELECT REGEXP_SUBSTR(TMP.P_STR, '[^_]+$', 1, 1) FROM TMP;
可以这样写, 不需要用count了 WITH TMP AS (SELECT '16_4253116201_3600*1*4' AS P_STR FROM DUAL) SELECT REGEXP_SUBSTR(TMP.P_STR, '[^_]+$', 1, 1) FROM TMP; 谢谢~!执行结果我去试一下
(select '16_4253116201_3600*1*4' as p_str from dual)
select regexp_substr(tmp.p_str,
'[^_]+',
1,
regexp_count(tmp.p_str, '[^_]+'))
from tmp;
WITH TMP AS
(SELECT '16_4253116201_3600*1*4' AS P_STR FROM DUAL)
SELECT REGEXP_SUBSTR(TMP.P_STR, '[^_]+$', 1, 1) FROM TMP;
WITH TMP AS
(SELECT '16_4253116201_3600*1*4' AS P_STR FROM DUAL)
SELECT REGEXP_SUBSTR(TMP.P_STR, '[^_]+$', 1, 1) FROM TMP;
谢谢~!执行结果我去试一下