锘??xml version="1.0" encoding="utf-8" standalone="yes"?>日韩电影在线播放,中文在线不卡,精品国产乱码久久久久久图片 http://www.aygfsteel.com/boyanxiu/category/44254.html浠拌瀹囧畽涔嬪ぇ 淇療JAVA涔嬬洓zh-cnThu, 11 Mar 2010 04:06:50 GMTThu, 11 Mar 2010 04:06:50 GMT60鏇村ソ鐨勫埄鐢ㄦ暟鎹簱鍘熺敓鍐呯疆鍑芥暟錛屾彁鍗噑ql鍑芥暟鐨勬晥鐜囷紒http://www.aygfsteel.com/boyanxiu/archive/2010/03/11/315159.htmlboyanxiuboyanxiuThu, 11 Mar 2010 03:41:00 GMThttp://www.aygfsteel.com/boyanxiu/archive/2010/03/11/315159.htmlhttp://www.aygfsteel.com/boyanxiu/comments/315159.htmlhttp://www.aygfsteel.com/boyanxiu/archive/2010/03/11/315159.html#Feedback0http://www.aygfsteel.com/boyanxiu/comments/commentRss/315159.htmlhttp://www.aygfsteel.com/boyanxiu/services/trackbacks/315159.html妗堜緥錛氬湪瀛楃涓茬被鍨嬪瓧孌典腑 姹傜洰鏍囧瓙涓插嚭鐜扮殑嬈℃暟錛堝湪oracle 9i涓嬫祴璇曪級(jí)
1.寤烘祴璇曟暟鎹傚緩琛╰est_tbl(鍚瓧絎︿覆綾誨瀷鐨勫瓧孌礳ontent),鎻掑叆10W鏉¤褰曘?/strong>
   --寤鴻〃      
   create table test_tbl (id number,content varchar2(1000))錛?br />    --鎻掑叆10W鏉℃祴璇曡褰?/span>
   begin
      dbms_random.seed(12345678);
      for i in 1 .. 100000
      loop
        insert into test_tbl values(i, dbms_random.string('L',dbms_random.value(10,1000)));
      end loop;
      commit;
    end; 
2.鍒涘緩鑷畾涔夊嚱鏁頒竴錛堥噰鐢ㄥ驚鐜埅瀛愪覆鐨勬柟寮忓疄鐜幫紝濡傛灉鎴埌鐨勫瓙涓茬瓑浜庣洰鏍囧瓙涓插垯鍑虹幇嬈℃暟鍔?銆傦級(jí)
   create or replace function f1(str_pattern in varchar2,str_mother in varchar2)
   return number
   is
    i number := 1;
    cnt number := 0;
    len_pattern number := length(str_pattern);
    len_mother number := length(str_mother);
   begin
    while(i <= len_mother)
      loop
        if(substr(str_mother, i ,len_pattern) = str_pattern) then
          cnt := cnt + 1;
          i := i+ len_pattern;
         else
         i := i+1;
        end if;
      end loop;
      return cnt;
    end;
3.鍒涘緩鑷畾涔夊嚱鏁頒簩(寰幆浣跨敤Instr鍑芥暟鍒╃敤occurrence鍙傛暟瀹炵幇錛屽驚鐜竴嬈ntr鍑芥暟寰楀埌涓涓綅緗畃os鍊鹼紝騫惰occurrence鍔?銆傚鏋減os鍊間笉涓洪浂錛岃〃紺虹洰鏍囧瓙涓茬occurrence嬈″湪姣嶄覆涓瓨鍦紱鍙嶄箣琛ㄧず鍐嶄篃涓嶅瓨鍦ㄤ簡錛屼簬鏄鍑哄驚鐜傛渶鍚巓ccurrence-1鍗充負(fù)鎵寰?
    Intr鍑芥暟璇存槑錛欼nstr(string, substring, position, occurrence) 鍏朵腑 
        string錛氫唬琛ㄦ簮瀛楃涓詫紱
        substring錛氫唬琛ㄦ兂鑱簮瀛楃涓蹭腑鏌ユ壘鐨勫瓙涓詫紱
        position錛氫唬琛ㄦ煡鎵劇殑寮濮嬩綅緗紝璇ュ弬鏁板彲閫夌殑錛岄粯璁や負(fù) 1錛?br />        occurrence錛氫唬琛ㄦ兂浠庢簮瀛楃涓煡鎵懼嚭絎嚑嬈″嚭鐜扮殑substring錛岃鍙傛暟涔熸槸鍙夌殑錛岄粯璁や負(fù)1錛?br />        榪斿洖鍊間負(fù)錛氭煡鎵懼埌鐨勫瓧絎︿覆鐨勪綅緗?/span>

create or replace function f2(str_pattern in varchar2,str_mother in varchar2)
  return number
  is
    pos number;
    occurrence number := 1;
   begin
      loop
         pos := instr(str_mother,str_pattern,1, occurrence);
         exit when pos = 0;
         occurrence := occurrence + 1;
       end loop;
       return occurrence - 1;
      end;        
3.嫻嬭瘯鏁堢巼                  

 select count(*) from test_tbl  where f1('abc',content) > 1
--鐢ㄦ椂59.223 S
select count(*) from test_tbl  where f2('abc',content) > 1
--鐢ㄦ椂2.016 S
select count(*) from test_tbl  where f1('a',content) > 10
--鐢ㄦ椂59.453 S
select count(*) from test_tbl  where f2('a',content) > 10
--鐢ㄦ椂8.36 S
4.鎬葷粨錛氬緢濂界殑鍒╃敤鍐呯疆鍑芥暟錛岀瀛︾殑鎶婂唴緗嚱鏁版斁鍒板悎鐞嗙殑浣嶇疆鑳藉緢濂界殑鎻愰珮鏁堢巼

5.鍚庤
   瀵逛簬璇ユ渚嬶紝濡傛灉鐩爣瀛愪覆鍚湁澶氫釜瀛楃鐢?span style="color: #0000ff">f2鏁堢巼杈冮珮錛屽鏋滅洰鏍囧瓙涓叉墍鍚瓧絎﹀緢灝戞瘮濡傚氨涓涓瓧絎?寤鴻鐢ㄧ畝渚垮姙娉曪細(xì)1.鍦ㄦ瘝瀛楃涓蹭腑鎶婃湪鐩爣瀛椾覆鏇挎崲涓虹┖('')寰楀埌鏂板瓧絎︿覆銆?.鍒╃敤 (姣嶄覆闀垮害-鏂頒覆闀垮害)/鐩爣瀛愪覆闀垮害 寰楀埌鐨勫氨鏄瓙涓茬殑鍑虹幇嬈℃暟銆?/span>


boyanxiu 2010-03-11 11:41 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 竹溪县| 高要市| 蓝山县| 城口县| 岑巩县| 苍溪县| 南通市| 双流县| 牙克石市| 孟村| 安泽县| 社旗县| 紫金县| 荔浦县| 井冈山市| 陆丰市| 齐河县| 泰安市| 新野县| 灌南县| 柳林县| 蒙自县| 天全县| 齐齐哈尔市| 永福县| 鞍山市| 精河县| 石城县| 阿拉尔市| 永昌县| 庐江县| 武定县| 安徽省| 陕西省| 太和县| 洪江市| 罗江县| 剑河县| 琼中| 广西| 林西县|