Oracle:使用pl-sql将选项卡分隔的文本文件中的记录导入数据库 [英] Oracle: importing records from tab delimited text file to database using pl-sql

查看:91
本文介绍了Oracle:使用pl-sql将选项卡分隔的文本文件中的记录导入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从未与Oracle合作过.这是第一次,工作非常棘手.我有一个文本文件,其中的记录用制表符分隔.这些记录将使用pl-sql导入数据库.我已经在线搜索过,但是解决方案建议使用SQL Loader实用程序.但要求是使用sql语句执行此操作.没有命令行实用程序. SP或UDF最好将文件路径和数据库名称作为输入参数,并在执行时导入记录.这可能吗?有人可以向我提供示例sql语句或任何逐步说明此过程的链接吗?另请注意,文件中可以有空白记录.提前致谢.

I have never worked with Oracle. This is the first time and the job is quite tricky. I have a text file with records delimited with tab. These records are to be imported into a database using pl-sql. I have searched online but the solutions suggests using SQL Loader utility. But the requirement is to do that using sql statements. No command line utility. Preferable the SP or UDF will take file path and database name as input parameters and it will import the records when executed. Is this possible? Can someone provide me sample sql statements or any link that explain this process step by step? Also note that there can be blank records in file. Thanks in advance.

推荐答案

外部表似乎是最好的方法.

External Tables seems like the best approach.

http://docs.oracle.com/cd/B19306_01/server.102/b14215/et_concepts.htm

可以使用UTL_FILE,但是您必须编写代码以解析制表符分隔的文本等.

UTL_FILE is possible but you would have to write the code to parse the tab delimited text etc.

这篇关于Oracle:使用pl-sql将选项卡分隔的文本文件中的记录导入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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