oracle逗號字串拼接小工具

來源:互聯網
上載者:User

標籤:

oracle逗號字串拼接小工具

http://www.zui#dai#ma.com/share/1932670249667584.htm

在使用oracle進行資料查詢時,常常需要使用到in語句,如果id是execl中匯出的,難道要一個一個的寫麼,這裡提供一個小工具,可以快速拼接in語句。

代碼如下:

01 function changeSQL(){
02   var srcSQL = document.getElementById("srcSQL");
03   var srcInner = srcSQL.value;
04   var sqlBuf = "in ( "
05    
06   var newSrc = "";
07   if(ie){
08    var newSrc = srcInner.split("\r\n");
09   }else{
10    var patt = new RegExp(/.+/g);
11    var newSrc = srcInner.match(patt);
12   }
13   var len = newSrc.length;
14   for(var i=0;i<len;i++){
15    var temp=newSrc[i];
16    if(i < len-1){
17    sqlBuf += "\‘"+temp+"\‘" ",";
18    }
19    if(i == len-1){
20    sqlBuf += "\‘"+temp+"\‘)";
21    }
22   }
23    
24   var showSQL = document.getElementById("showSQL");
25   showSQL.innerText = sqlBuf;
26  }

 

01 <table border="1" width="350" height="450" >
02  <tr align="center">
03   <td width="45%"><textarea id="srcSQL" rows="28" cols="60" ></textarea></td>
04   <td>
05    <button onclick="changeSQL()" style="cursor:hand;"><font color="blue" size="5"><b>轉換</b></button><p>
06     
07   </td>
08   <td width="45%"><textarea id="showSQL" rows="28" cols="60" ></textarea></td>
09  </tr>
10 </table>

其實HTML可以改成.hta尾碼,是可執行檔檔案,如下:

猜你喜歡

oracle逗號字串拼接小工具

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.