Reputation: 103
I need to extract a string from a given set of string. The string given is :
Data string 1 : LOAD TEST ABC,2146520,9856452147
Data string 2 : LOAD TEST:804749:9756325874
Here, the string set has a static value "LOAD TEST ABC" and "LOAD TEST", here i need to extract the string from the middle 2146520 and 804749 as an Id.
Upvotes: 1
Views: 28
Reputation: 520968
You might be able to use REGEXP_SUBSTR
here with a capture group:
SELECT col, REGEXP_SUBSTR(col, '[,:](.+?)[,:]', 1, 1, NULL, 1) AS middle_num
FROM yourTable;
Upvotes: 1