Using Text_IO To Read Files in Oracle D2k
Suppose you want to read a file from D2k client and want to store its content in Oracle database. But if you will insert row by row from client to server it will take more time and increase lot of network traffic / round trips.
The solution of this problem is to store the content of the text file into an array and then pass it to database procedure and insert record through that procedure. Here is the example step by step:
1) Create a package in Oracle database.
as
Type textrow is table of Varchar2(1000)
index by binary_integer;
Procedure Insert_into_table (iarray in textrow);
End;
/
Create or Replace Package Body DB_insert
as
Procedure Insert_into_table(iarray in textrow)
is
Begin
For i in 1..iarray.count loop
Insert into Dummytbl values (iarray(i));
-- you can extract the content from iarray(i) to insert values into multiple fields
-- e.g. iarray(i).fieldname
--
End Loop;
Commit;
End;
/
2) Now in D2k write a procedure to read text file and store it into array and pass it to that package you crated above.
is
infile Text_IO.File_type;
irow DB_insert.textrow;
nelm number := 1;
Begin
infile := text_io.fopen(ifilename, 'r');
Loop
text_io.get_line(infile, irow(nelm));
nelm := nelm + 1;
End Loop;
Exception
when no_data_found then
-- end of file reached
text_io.fclose(infile);
message('Read Completed.');
-- pass it to database
DB_insert.insert_into_table(irow);
message('Data saved.');
when others then
if text_io.is_open(infile) then
text_io.fclose(infile);
end if;
message(sqlerrm);
End;
See also: Reading csv files with Text_io
http://foxinfotech.blogspot.com/2013/02/reading-and-importing-comma-delimited.html
Using Text_IO To Read Files in Oracle D2k的更多相关文章
- Reading Csv Files with Text_io in Oracle D2k Forms
Below is the example to read and import comma delimited csv file in oracle forms with D2k_Delimited_ ...
- Obtaining Query Count Without executing a Query in Oracle D2k
Obtaining Query Count Without executing a Query in Oracle D2k Obtaining a count of records that will ...
- Using Call_Form in Oracle D2k
Using Call_Form in Oracle D2k CALL_FORM examples/* Example 1:** Call a form in query-only mode.*/BEG ...
- Using GET_APPLICATION_PROPERTY in Oracle D2k Forms
Using GET_APPLICATION_PROPERTY in Oracle D2k Forms DescriptionReturns information about the current ...
- DISPLAY_ITEM built-in in Oracle D2k Forms
DISPLAY_ITEM built-in in Oracle D2k Forms DescriptionMaintained for backward compatibility only. For ...
- Pre-Query trigger in Oracle D2k / Oracle Forms
Pre-Query trigger in Oracle D2k / Oracle Forms DescriptionFires during Execute Query or Count Query ...
- Creating List Item in Oracle D2k
Special Tips for List Items in Oracle D2k In this section, I shall discuss some special tips and tec ...
- Creating Object Library OLB in Oracle D2k Form
With following steps you can create Object Library (OLB) in Oracle D2k Forms.Step - 1Create a form i ...
- Creating Timer in Oracle D2k / Forms 6i and Displaying a Clock
Creating Timer in Oracle D2k / Forms 6i and Displaying a Clock This is about timer in D2k An externa ...
随机推荐
- 广播发送者&广播接收者介绍
1.广播接收者 广播接收者简单地说就是接收广播意图的Java类,此Java类继承BroadcastReceiver类,重写: public void onReceive(Context context ...
- delphi注册/反注册OCX
uses ShellAPI; function ExecAndWait(const ExecuteFile, ParamString : string): boolean; var SEInfo: T ...
- 第三方过滤器在TVideoGrabber中的使用
在TVideoGrabber中可以使用第三方过滤器,并可插入到预览.录制或回放流中,添加到列表里. 要在一个图像中中应用一个过滤器,需要像下面的例子中一样调用 ThirdPartyFilter_Add ...
- 图像处理工具包ImagXpress中如何定义查看器的属性
想要在图像处理控件ImagXpress中查看一个图像,首先需要创建一个查看器,之后你可以按照你自身的需要,来定义查看器的属性. 创建查看器 想要动态的创建一个查看器,需要先定义一个新的mageXVie ...
- iOS OC与swift相互调用
小哥("我"的自称)个人混编的时候喜欢先创建OC项目,然后在项目中创建swift类.这样有个好处就是桥文件可以自动创建的同事路径不需要我手动去写了,另外还有个目的就是现在小哥自我感 ...
- Add baidu map in your website (wordpress)
手动挡 访问应用(AK)Key http://lbsyun.baidu.com/apiconsole/key Basic Map Generator http://api.map.baidu.com/ ...
- ARM多核处理器启动过程分析【转】
转自:http://blog.csdn.net/qianlong4526888/article/details/27695173 版权声明:本文为博主原创文章,未经博主允许不得转载. 说明: 该流程图 ...
- NDK
Android NDK是Google提供的开发Android原生程序的工具包,很多软件和病毒采用基于Android NDK动态库的调用技术,隐藏了在实现上的很多细节. 一.(windows版) 下载地 ...
- 在centos6.5上面mount微软系统上安装ftp服务器
---恢复内容开始--- 现在用虚拟机开发linux软件,发现虚拟机提供的共享文件夹不能很好地工作,表现为: 1.我在windows上面修改了文件内容,在linux里面发现文件内容没有变化,需要做些等 ...
- git 冲突
git中冲突会用特殊的标记 (<<<<<<<=======>>>>>>>) 特殊标记<<<< ...