Split string oracle into a single column and insert into a table

前端 未结 3 1503
轻奢々
轻奢々 2020-12-20 05:31

I have a table with column data in below format(Row# just to indicate row number).

Row#1 :test.doc#delimiter#1234,test1.doc#delimiter#1235,test2.doc#delimit         


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-20 06:04

    if you want to find an existing delimier and split it

    try this query :

    select  substr(filed_name ,
                   REGEXP_SUBSTR(filed_name,'#demilimer#',1),
                   (REGEXP_SUBSTR(filed_name,'#demilimer#',2)-1)
        ) col1  ,  
    
      substr(filed_name ,
                   REGEXP_SUBSTR(filed_name,'#demilimer#',2),
                   REGEXP_SUBSTR(filed_name,'#demilimer#',3)- (REGEXP_SUBSTR(filed_name,'#demilimer#',2))
        ) col2  ,
         substr(filed_name ,
                   REGEXP_SUBSTR(filed_name,'#demilimer#',3),
                   length(filed_name)- (REGEXP_SUBSTR(filed_name,'#demilimer#',3))
        ) col3        /* last col should take up to the length  */
    
    from table_name
    

提交回复
热议问题