Oracle11g 如何使用with子句向select语句添加额外的列

Oracle11g 如何使用with子句向select语句添加额外的列,oracle11g,Oracle11g,如何在下面的sql语句中添加V\u SP\u CDRA\u WEEKLY\u UPDATE.indication列。到目前为止,它只显示str_out列。任何帮助都将不胜感激 with transformation(str_in,flag,str_out) as (select substr(s,instr(s,'href=') + 5),1,cast(substr(s,1,instr(s,'href=') + 4) as varchar2(4000)) from (

如何在下面的sql语句中添加V\u SP\u CDRA\u WEEKLY\u UPDATE.indication列。到目前为止,它只显示str_out列。任何帮助都将不胜感激

 with
    transformation(str_in,flag,str_out) as
    (select  substr(s,instr(s,'href=') + 5),1,cast(substr(s,1,instr(s,'href=') + 4) as varchar2(4000))
    from (select  KEY_DOCUMENTS s From V_SP_CDRA_WEEKLY_UPDATE Where KEY_DOCUMENTS like '%%https:%%')
    union all
    select substr(str_in,2),
            case when flag = 1
                  and substr(str_in,1,1) != '>'
                 then 1
                 when substr(str_in,1,1) = '>'
                 then 0
                 when substr(str_in,1,5) = 'href='
                 then 1
                 else 0
            end,
            str_out || case when substr(str_in,1,1) = ' '
                             and flag = 1
                            then '%20'
                            else substr(str_in,1,1)
                       end
       from transformation
      where length(str_in) > 0
    )
    select str_out
      from transformation
    where str_in is null;

我不知道你的数据,所以我试着问你的问题:

with
    transformation(str_in, flag, str_out, indication) as
       (select  substr(s,instr(s,'href=') + 5),
                1,
                cast(substr(s,1,instr(s,'href=') + 4) as varchar2(4000)),
                i
        from (select KEY_DOCUMENTS s, indication i
              From V_SP_CDRA_WEEKLY_UPDATE
              Where KEY_DOCUMENTS like '%%https:%%')
        union all
        select substr(str_in,2),
               case when flag = 1  and substr(str_in,1,1) != '>'
                    then 1
                    when substr(str_in,1,1) = '>'
                    then 0
                    when substr(str_in,1,5) = 'href='
                    then 1
                    else 0
               end,
               str_out || case when substr(str_in,1,1) = ' '   and flag = 1
                               then '%20'
                               else substr(str_in,1,1)
                          end,
               null as i
        from transformation
        where length(str_in) > 0)
select str_out, indication
from transformation
where str_in is null;