2014-02-06 32 views
0

如何將V_SP_CDRA_WEEKLY_UPDATE.indication列添加到以下sql語句中。截至目前它只顯示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; 

回答

0

我不知道你的數據,所以我要問你的問題:

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; 
相關問題