5
A
回答
8
下面的示例SQL演示瞭如何插入,包含XMLTYPE數據類型的查詢和更新數據庫字段:
-- Create a table that can store XML
create table sample_xml (id number, xml xmltype);
-- Insert some XML into the table
insert into sample_xml values (1, xmltype.createxml('<subject><name>test</name><list><li>a</li><li>b</li></list></subject>'));
insert into sample_xml values (2, xmltype.createxml('<subject><name>test</name><list><li>a</li></list></subject>'));
-- When doing a select, refer to table using the alias or getClobVal() will not work
select t.id, t.xml.getClobVal() from sample_xml t;
-- Update text of a single xml element
UPDATE sample_xml SET xml = UPDATEXML(xml, '/subject/name/text()','happy') WHERE id = 2;
-- Select out just the name for each row in the table using xpath
select id, extractvalue(xml, '/subject/name/text()') from sample_xml;
-- Doing an sample_xml, where the xpath string matches two elements, the text of both elements will be updated
UPDATE sample_xml SET xml = UPDATEXML(xml, '/subject/list/li/text()','one');
相關問題
- 1. 對象數據庫介紹
- 2. 介紹XML驗證錯誤
- 3. 介紹如何使用的變量
- 4. 介紹各種攻擊類型
- 5. 內存地址和數據類型介紹
- 6. 每個命令後的sql oracle介紹
- 7. hasOne亞型介紹CakePHP
- 8. 好的泛型介紹
- 9. Def函數介紹
- 10. 介紹了Memcached
- 11. 介紹CakePHP
- 12. 顯示分類介紹Prestashop
- 13. 介紹動畫
- 14. 介紹COM DLL
- 15. Java關閉介紹
- 16. 乳膠介紹
- 17. php介紹
- 18. 快速XML到數據庫
- 19. xacml實現介紹
- 20. MySQL的獲取數據的介紹
- 21. IOS介紹PageViewController
- 22. 介紹CakePHP
- 23. Keras Seq2Seq介紹
- 24. Ocaml介紹
- 25. SVN介紹
- 26. codeigniter wkhtmltopdf介紹
- 27. 介紹UINavigationController Swift
- 28. Cognos 8介紹
- 29. Node.js介紹
- 30. 介紹CakePHP 3
壞事。要麼獲得博客,要麼創建這個社區wiki! – 2010-10-20 05:36:40
你如何使它成爲「社區wiki」?我的印象是,這樣的事情被鼓勵,根據[stackoverflow常見問題](http://stackoverflow.com/faq) – corydoras 2010-10-20 05:39:05
它應該仍然是一個問題,但。 「我如何處理」有點寬泛。無論如何。 – Thilo 2010-10-20 06:08:51