日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

dbms_lob包学习笔记之三:instr和substr存储过程

發布時間:2025/3/14 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 dbms_lob包学习笔记之三:instr和substr存储过程 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
instr和substr存儲過程,分析內部大對象的內容instr函數與substr函數 instr函數用于從指定的位置開始,從大型對象中查找第N個與模式匹配的字符串。 用于查找內部大對象中的字符串的instr函數語法如下: dbms_lob.instr( lob_loc in blob, pattern in raw, offset in integer := 1; nth in integer := 1) return integer;dbms_lob.instr( lob_loc in clob character set any_cs, pattern in varchar2 character set lob_loc%charset, offset in integer:=1, nth in integer := 1) return integer;lob_loc為內部大對象的定位器 pattern是要匹配的模式 offset是要搜索匹配文件的開始位置 nth是要進行的第N次匹配substr函數 substr函數用于從大對象中抽取指定數碼的字節。當我們只需要大對象的一部分時,通常使用這個函數。 操作內部大對象的substr函數語法如下: dbms_lob.substr(lob_loc in blob, amount in integer := 32767,offset in integer := 1) return raw;dbms_lob.substr(lob_loc in clob character set any_cs, amount in integer := 32767,offset in integer := 1) return varchar2 character set lob_loc%charset; 其中各個參數的含義如下: lob_loc是substr函數要操作的大型對象定位器 amount是要從大型對象中抽取的字節數 offset是指從大型對象的什么位置開始抽取數據。 如果從大型對象中抽取數據成功,則這個函數返回一個 raw 值。如果有一下情況,則返回null:1 任何輸入參數尾null2 amount < 13 amount > 327674 offset < 15 offset > LOBMAXSIZE 示例如下:declare source_lob clob;pattern varchar2(6) := 'Oracle';start_location integer := 1;nth_occurrence integer := 1;position integer;buffer varchar2(100); beginselect clob_locator into source_lob from mylobs where lob_index = 4;position := dbms_lob.instr(source_lob, pattern, start_location, nth_occurrence);dbms_output.put_line('The first occurrence starts at position:' || position);nth_occurrence := 2;select clob_locator into source_lob from mylobs where lob_index = 4;position := dbms_lob.instr(source_lob, pattern, start_location, nth_occurrence);dbms_output.put_line('The first occurrence starts at position:' || position);select clob_locator into source_lob from mylobs where lob_index = 5;buffer := dbms_lob.substr(source_lob, 9, start_location);dbms_output.put_line('The substring extracted is: ' || buffer); end; / The first occurrence starts at position:8 The first occurrence starts at position:24 The substring extracted is: Oracle 9iPL/SQL 過程已成功完成。

?作者:hellofei

轉載于:https://www.cnblogs.com/lxl57610/p/9253452.html

總結

以上是生活随笔為你收集整理的dbms_lob包学习笔记之三:instr和substr存储过程的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。