Monday, 28 December 2020

Split string and extract nth word in Oracle

  

Split string and extract nth word in Oracle


Here I am taking 5 word from string glaccount example 


222-333-23434-2222333-000-0000-888

select REGEXP_SUBSTR(glaccount, '[^-]+', 1, 3) AS glaccount from Workorder

Output : 23434 


Here  we are separting word with delimitter - if you have comma replace hiphen with comma.

No comments:

Post a Comment