有没有一种方法可以使用Oracle SQL从URL中提取ID?

时间:2020-03-18 07:48:15

标签: sql oracle

URL以“ https://”开头,并添加了utm参数。我想提取最后一个utm参数的值,这对于用户来说是唯一的;我想使用Oracle SQL提取它。我尝试使用regexp_replace和regexp_substr PHP函数,但无法将其提取。

javascript/typescript

我要提取“ Max_Test_Proof_VP”,这是最后一个参数。 用户可以更改此参数。有些可能只有数字值,并且长度可能会改变。但是,变量“ LMR_ID =“将保持不变。

我该如何提取? 请在这件事上给予我帮助!预先感谢。

1 个答案:

答案 0 :(得分:3)

提取“最后一个字”:

SQL> with test (url) as
  2    (select 'https://www.mfashion.in/in/en/department/maxmen?utm_source=ResponsysMailing&utm_medium=email&utm_campaign=MaxFashion_Test&LMR_ID=Max_Test_Proof_VP' from dual)
  3  select regexp_substr(url, '\w+$') result
  4  from test;

RESULT
-----------------
Max_Test_Proof_VP

SQL>