Split delimited string value into rows

前端 未结 3 1975
栀梦
栀梦 2020-12-10 09:25

Some external data vendor wants to give me a data field - pipe delimited string value, which I find quite difficult to deal with.

Without help from an application pr

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-10 09:28

    It may not be as difficult as I initially thought.

    This is a general approach:

    1. Count number of occurrences of the delimiter length(val) - length(replace(val, '|', ''))
    2. Loop a number of times, each time grab a new delimited value and insert the value to a second table.

提交回复
热议问题