将表导出到多个csv文件的过程 [英] Procedure to export table to multiple csv files

查看:74
本文介绍了将表导出到多个csv文件的过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Oracle数据库-我唯一需要访问它的方法是通过SQL Developer.我的一部分工作是将大型表导出到csv文件中,然后传递给另一个组.由于这主要是保姆系统,因此我一直在寻找一种使导出过程自动化的方法.

I am working with an Oracle database - the only way I have to access it is through SQL Developer. Part of my work involves exporting large tables to csv files to pass to another group. Since this is mostly babysitting the system, I've been looking for a way to automate the export process.

我想要的是一个像这样的程序:

What I would like is to have a procedure like so:

PROCEDURE_EXAMPLE(table_in in VARCHAR2, file_out in VARCHAR2)

其中table_in是我需要导出的表,它将表导出到一系列名为"file_out_1.csv","file_out_2.csv"等的csv文件中.每个文件不超过500万行.

where table_in is the table I need to export, and it exports the table to a series of csv files titled "file_out_1.csv" "file_out_2.csv", etc.. each with no more than 5 million rows.

是否可以创建这样的过程?

Is it possible to create a procedure like this?

推荐答案

您可以使用UTL_FILE包.您只能读取运行数据库实例的服务器上可访问的文件.

You can using the UTL_FILE package. You can only read files that are accessible from the server on which your database instance is running.

请参见 http ://www.devshed.com/c/a/Oracle/Reading-Text-Files-using-Oracle-PLSQL-and-UTLFILE/ Oracle写入文件

这篇关于将表导出到多个csv文件的过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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