Split varchar into separate columns in Oracle

前端 未结 3 755
难免孤独
难免孤独 2020-12-13 20:10

I\'m in a bit of a pickle: I\'ve been asked to take in comments starting with a specific string from a database, and separate the result into separate columns.

For

3条回答
  •  眼角桃花
    2020-12-13 20:39

    With REGEXP_SUBSTR is as simple as:

    SELECT REGEXP_SUBSTR(t.column_one, '[^ ]+', 1, 1) col_one,
           REGEXP_SUBSTR(t.column_one, '[^ ]+', 1, 2) col_two
    FROM YOUR_TABLE t;
    

提交回复
热议问题