简体   繁体   English

Oracle View结果导出为CSV文件

[英]Oracle view result export as csv file

i am not expert in sql query in oracle but i got a task to export view result as csv file. 我不是oracle中sql查询的专家,但是我有一个任务可以将视图结果导出为csv文件。 i was instructed to create a materialized view to export. 我被指示创建要导出的实例化视图。 i have been google it for past two days but i have no luck. 我过去两天一直在Google上搜索它,但是我没有运气。

are we able to export as csv file by using materialized or which way(procedure or function) to export as csv? 我们能否通过使用物化或哪种方式(过程或函数)导出为csv导出为csv文件?

thanks all 谢谢大家

"I was instructed to create a materialized view to export" “指示我创建要导出的实例化视图”

This is very important. 这个非常重要。 If you were told to build a MV to get the data out, then this indicates that the data is slow to gather. 如果要求您构建MV来取出数据,则表明数据收集缓慢。

In other words, the query you would use to get the data ready to export to CSV would take a very long time. 换句话说,将用于准备将数据导出为CSV的查询将花费很长时间。

Materialized Views are performance features of the database where you can take a query result and save that as a permanent object in the database, so querying it is very fast. 物化视图是数据库的性能功能,您可以在其中获取查询结果并将其保存为数据库中的永久对象,因此查询速度非常快。

You have to the decide how often you want to refresh those results - is it OK if the query is fast but the data is 5 minutes old? 您必须决定要多久刷新一次这些结果-如果查询速度快但数据已存在5分钟,可以吗?

Once you have the MV created, getting the data from it to CSV becomes a known exercise, as @kris-rice indicates in his comment above. 创建了MV之后,将数据从其中获取到CSV就成为一种已知的练习,就像@ kris-rice在上面的评论中指出的那样。

I will say, what makes the most sense will be determined in large part by how much data you are talking about, and what you want to do with it when you're done. 我会说,什么才是最有意义的,将在很大程度上取决于您正在谈论的数据量以及完成后想要使用的数据。 Provide this data i your question, and we'll give you a better answer. 在您的问题中提供此数据,我们将为您提供更好的答案。

Creating a MV is on the surface, quite simple, but due to the numerous refresh options, you'll need to know a good bit about your biz requirements so you can make the right decisions. 表面上创建MV非常简单,但是由于有许多刷新选项,您需要对业务需求有一定的了解,以便您做出正确的决定。

Once you know that, building one can be done quite easily using the dialog in SQL Developer if you want a GUI. 知道这一点后,如果需要GUI,可以使用SQL Developer中的对话框轻松地完成构建。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM