Oracle 如何将查询导出到文本/csv 文件

2021-12-24 00:00:00 csv text-files export oracle plsql

我想知道如何将查询从 PL/SQL 导出到文本文件或 csv 文件.我想到的查询导出了大量数据(大约 1 gig).所以我也希望将数据拆分到多个文件中;

I was wondering how to go about exporting a query from PL/SQL to an text file or csv file. The query I have in mind exports a huge amount of data (about 1 gig). So I'd also like the data split across multiple files;

out1.csv输出2.csvout3.csv

out1.csv out2.csv out3.csv

我希望能够决定将它分成多少个文件.

I'd like to be able to decide how many files to split it across.

有人知道怎么做吗?

推荐答案

使用 UTL_FILE.

一个众所周知的(可能是关于这个主题的最完整的讨论)的讨论可以在 Ask Tom 中找到,此处,请注意其中的许多示例都可以追溯到 oracle 8,因此在您的版本中可能有更好的方法甲骨文.

A well known ( probably the most complete discussion on this topic ) discussion on this can be found at Ask Tom, Here , note that many of the examples there date back to oracle 8, so there may be better ways to do it in your version of Oracle.

相关文章