91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

extractvalue處理XMLTYPE類型超過4000字節ORA-01706的解決方法

發布時間:2020-08-14 15:40:17 來源:ITPUB博客 閱讀:843 作者:guocun09 欄目:關系型數據庫

extractvalue在處理XMLTYPE類型運算時非常方便,但在處理超過4000字節column就力不從心了。

問題:

一位朋友在Oracle中使用extractvalue處理XMLTYPE類型時,發現column值超過4000字節時就會報錯ORA-01706.

是否真會這樣呢?

通過實驗重現問題:

1.創建XML table

Create TABLE testxml(
id NUMBER,
data XMLTYPE
);

2.創建目錄

CREATE OR REPLACE DIRECTORY 
EXPDP_DIR AS 
'/data/expdp_dir/';

3.在目錄/data/expdp_dir/ 中建立11.xml文件, 模擬Data2長度為4001字節,文件內容如下:

<Workbook>
<Row>
<Data1>MES</Data1>
<Data2>01234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340123401234012340</Data2>
</Row>
</Workbook>

4.通過bfile方式insert數據

insert into testxml(id,data)
values(6,xmltype(bfilename('EXPDP_DIR','11.xml'),nls_charset_id('AL32UTF8')));
commit;

5.查看insert后數據

select *from testxml

extractvalue處理XMLTYPE類型超過4000字節ORA-01706的解決方法

6.使用extractvalue查詢小于4000字節column Data1,可以正常返回結果

select  extractvalue(data,'/Workbook/Row/Data1') from testxml;

extractvalue處理XMLTYPE類型超過4000字節ORA-01706的解決方法

7 . 使用 extractvalue 查詢大于4000字節column Data2,出現報錯 ORA-01706

select  extractvalue(data,'/Workbook/Row/Data2') from testxml;

extractvalue處理XMLTYPE類型超過4000字節ORA-01706的解決方法

以上證實extractvalue無法處理大于4000字節column

解決:

查看Oracle官方文檔對extractvalue函數的介紹

  https://docs.oracle.com/cd/E11882_01/server.112/e41084/functions061.htm#SQLRF06173

  The EXTRACTVALUE function is deprecated. It is still supported for backward compatibility. However, Oracle recommends that you use the XMLTABLE function, or the XMLCAST and XMLQUERY functions instead. See XMLTABLE , XMLCAST , and XMLQUERY for more information.

原來官方已建議不要再使用extractvalue,而建議使用XMLTABLE,XMLCASE,XMLQUERY函數

繼續查閱XMLTABLE使用文檔 

https://docs.oracle.com/cd/E11882_01/server.112/e41084/functions253.htm#SQLRF06232

利用XMLTABLE函數處理大于4000字節column:

SELECT * FROM testxml,XMLTABLE('/Workbook' PASSING testxml.data COLUMNS CON clob PATH '/Workbook/Row/Data2' )

在XMLTABLE可以自定義字符類型,這里指定clob類型可成功獲取超過4000字節數據

extractvalue處理XMLTYPE類型超過4000字節ORA-01706的解決方法

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

灵宝市| 资阳市| 安化县| 太原市| 通城县| 吴江市| 马尔康县| 上犹县| 科技| 龙口市| 石阡县| 夏津县| 泸州市| 福海县| 长泰县| 项城市| 彭州市| 鄯善县| 吐鲁番市| 房山区| 勃利县| 罗田县| 驻马店市| 新邵县| 罗源县| 甘南县| 广灵县| 英超| 宁明县| 邳州市| 仁布县| 通山县| 房产| 东平县| 玛多县| 盐亭县| 中阳县| 商城县| 石棉县| 宁城县| 泗阳县|