SQL长格式到宽格式

时间:2018-09-06 23:47:13

标签: sql oracle

我下表的格式为

TIdHTTP

我需要将格式转换为以下格式

with newhttp do begin
  AllowCookies := True;
  HandleRedirects := False ;
  ProxyParams.BasicAuthentication := False;
  ProxyParams.ProxyPort := 0;
  RedirectMaximum := 15;
  Request.Accept := 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8';
  Request.AcceptEncoding := 'gzip, deflate';
  Request.AcceptLanguage := 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7';
  Request.ContentEncoding := 'UTF-8';  //in test
  Request.CharSet := 'UTF-8'; //   //in test
  Request.AcceptCharSet := 'UTF-8';  ////in test
  response.CharSet := 'UTF-8';   //in test
  Response.ContentEncoding := 'UTF-8';  //in test
  Response.ContentType := 'text/plain';  //in test
  Request.BasicAuthentication := False;
  readtimeout:=60000;
  Request.UserAgent := MyAgent;
  HTTPOptions := [hoForceEncodeParams];
  cookiemanager := MyCookie;
end;

1 个答案:

答案 0 :(得分:0)

您可以将regexp_substr(t.order_items,'7040')='7040'这样的排序规则与case..when表达式一起使用:

select t.order_id,
       ( case when regexp_substr(t.order_items,'7040')='7040' then
          'true'
         else
          'false'
         end ) as "I_7040",
       ( case when regexp_substr(t.order_items,'1308')='1308' then
          'true'
         else
          'false'
         end ) as "I_1308",   
       ( case when regexp_substr(t.order_items,'22')='22' then
          'true'
         else
          'false'
         end ) as "I_22"
  from tab t;

SQL Fiddle Demo