oracle sql中的查询将表数据导出到xml ot .txt文件中是什么。 [英] What is the query in oracle sql to export table data into an xml ot .txt file.

查看:68
本文介绍了oracle sql中的查询将表数据导出到xml ot .txt文件中是什么。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个查询将数据从表复制到xml文件或txt文件但不使用卸载函数或导出函数。

解决方案

 bcp   SELECT FirstName,LastName FROM AdventureWorks2008R2.Person.Person ORDER BY LastName,Firstname queryout Contacts.txt -c -T 



参考这个


我希望这会有所帮助。



详细信息此处 [ ^ ]



  SELECT  XMLElement( 员工
XMLAttributes(' http://www.w3.org/2001/XMLSchema' AS
xmlns:xsi
' http://www.oracle.com/Employee.xsd' AS
xsi:no namespaceSchemaLocation),
XMLForest(employee_id,last_name,salary)) AS RESULT
FROM hr.employees
WHERE department_id = 10 ;





这个创建符合XML模式Employee.xsd的以下XML文档(实际结果不是很漂亮)。



结果
------------------------------------------------- ----------------------------
< employee xmlns:xsi =http://www.w3.org/ 2001 / XMLSchema的>
xsi:nonamespaceSchemaLocation =http://www.oracle.com/Employee.xsd>
< employee_id> 200< / employee_id>
< last_name> Whalen< / last_name>
< salary> 4400< / salary>
< / employee>

选择1行。





[请鼓励参与投票解决方案或对您有用的答案]


I need a query to copy data from tables to an xml file or txt file but not using the unloading function or export function.

解决方案

bcp "SELECT FirstName, LastName FROM AdventureWorks2008R2.Person.Person ORDER BY LastName, Firstname" queryout Contacts.txt -c -T 


Refer this


I hope this helps.

Details here[^]

SELECT XMLElement("Employee", 
                  XMLAttributes('http://www.w3.org/2001/XMLSchema' AS
                                  "xmlns:xsi",
                                'http://www.oracle.com/Employee.xsd' AS
                                  "xsi:nonamespaceSchemaLocation"),
                  XMLForest(employee_id, last_name, salary)) AS "RESULT"
   FROM hr.employees
   WHERE department_id = 10;



This creates the following XML document that conforms to XML schema Employee.xsd (the actual result is not pretty-printed).

RESULT
-----------------------------------------------------------------------------
<employee xmlns:xsi="http://www.w3.org/2001/XMLSchema">
          xsi:nonamespaceSchemaLocation="http://www.oracle.com/Employee.xsd">
   <employee_id>200</employee_id>
   <last_name>Whalen</last_name>
   <salary>4400</salary>
</employee>

1 row selected.



[Please encourage participation by up-voting solutions or answers that work for you]


这篇关于oracle sql中的查询将表数据导出到xml ot .txt文件中是什么。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆