比如一个表的数据是1113494,'datasoucr','figh',这其中主键是1113494
将这行数据输出到另一个表成为1113494,'datasoucr'和1113494,'figh'
不能写存储过程,直接用SQL来写

解决方案 »

  1.   

    存这条记录(1113494,'datasoucr','figh',)的表的格式是什么样的,几列?
      

  2.   


    --这个意思?
    with t(col1,col2) as(
    select 1113494,'datasoucr,figh' from dual
    )
    select col1,regexp_substr(col2, '[^,]+',1,rownum) col2
    from t connect by rownum<=length(col2)-length(replace(col2, ',', ''))+1;
    /*
          COL1 COL2                                                                 
    ---------- --------------------                                                 
       1113494 datasoucr                                                            
       1113494 figh  
    */
      

  3.   

    'datasoucr','figh' 这是一列的内容还是两个列的内容,这很关键的
      

  4.   

    insert into B select col1,col2 from A;
    insert into B select col1,col3 from A;
      

  5.   

    select 1113494,'datasoucr'
    from table1
    union all
    1113494,'figh'
    from table1
      

  6.   

    select 1113494,'datasoucr'
    from table1
    union all
    select 1113494,'figh'
    from table1