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_String package. This package is available in D2kdlstr.pll library.
To download D2kdlstr.Pll Click Here
Create the following procedure in program unit of Oracle forms.
Procedure Import_csv_file (I_FILENAME IN VARCHAR2) Is
-- Text File Type
Infile Text_Io.File_Type;
Linebuf Varchar2 (4000);
V_Getstring Varchar2 (100);
-- Field Values Array
Type Fieldvalue Is Table Of Varchar2(100)
Index By Binary_Integer;
Fv Fieldvalue;
Rec_Count Number := 0;
Begin
Infile := Text_Io.Fopen (I_FILENAME, 'R');
-- Read File
Loop
---
Rec_Count := Rec_Count + 1;
Text_Io.Get_Line (Infile, Linebuf);
Linebuf := Linebuf || ',';
-- read from 1 to number of occurrences of comma or any other delimiter
-- below giving example for 3 occurrences
For I In 1 .. 3
Loop
Fv (I) := D2k_Delimited_String.Getstring (Linebuf, I, False, ',');
End Loop;
Begin
---
Insert Into yourtable (col1, col2, col3)
Values ( Fv(1), Fv(2), Fv(3));
Exception
When Others
Then
Message (Sqlerrm);
End;
End Loop;
Text_Io.Fclose (Infile);
Exception
When No_Data_Found Then
-- End Of The Text File Reached.... Then Save...
commit_form;
-- Message(Sqlerrm);
Text_Io.Fclose (Infile);
Message ('Import Completed.');
When Others Then
Text_Io.Fclose (Infile);
message(sqlerrm);
End;
See also:
http://www.foxinfotech.in/2014/02/writing-text-file-from-tabular-block-oracle-forms.html
Reading CSV Files in Oracle Forms
Reviewed by Marian Burn on
Feb 25
Rating:
5
Reading Csv Files with Text_io in Oracle D2k Forms的更多相关文章
- 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 ...
- 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 ...
- Refresh / Updating a form screen in Oracle D2k Forms 6i
Refresh / Updating a form screen in Oracle D2k Forms 6i ProblemYou want to show number of records pr ...
- CHECKBOX_CHECKED built-in in Oracle D2k Forms
CHECKBOX_CHECKED built-in in Oracle D2k Forms DescriptionA call to the CHECKBOX_CHECKED function ret ...
- Creating Dynamic LOV in Oracle D2k Forms
Dynamic Lov is a good idea for the form where too many Lov requirement is there with different recor ...
- How To Tune or Test PLSQL Code Performance in Oracle D2k Forms
You can test or tune your program unit performance in Oracle forms with Ora_Prof package.Suppose you ...
- 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. Bu ...
- 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 ...
随机推荐
- 【crunch bang】程序中文化
在应用程序中配置使用中文显示. # apt-get install locales # dpkg-reconfigure locales 安装文泉驿-微米黑字体: sudo apt-get insta ...
- java继承关系中成员变量,构造方法,成员方法的关系
Java继承中的成员关系 A:成员变量 a:子类的成员变量名称和父类中的成员变量名称不一样,这个太简单写那个名字就访问那个名字! b:子类的成员变量名称和父类中的成员变量名称一样,这个怎么访问呢? 子 ...
- TreeView htc 改写
call the function loadTree(treeviewId) when body is loaded <body onload="loadTree('tvSelect' ...
- 【JQGRID DOCUMENTATION】.学习笔记.1.安装jqGrid
前面介绍了怎么使用其MVC方式,很好用.不过,觉得还是只使用前段比较好. 1.1 如何安装 到http://www.trirand.com/blog/?page_id=6 下载. </html& ...
- Android实现推送方式解决方案(转)
本文介绍在Android中实现推送方式的基础知识及相关解决方案.推送功能在手机开发中应用的场景是越来起来了,不说别的,就我们手机上的新闻客户端就时不j时的推送过来新的消息,很方便的阅读最新的新闻信息. ...
- SpringMVC 接收复杂对象
要发送的数据为:String topicId,String topicName,String summarize,List<ModuleParam> parentList 前端页面ajax ...
- Oracle中左右外连接详解
数据表的连接有: 1.内连接(自然连接): 只有两个表相匹配的行才能在结果集中出现 2.外连接: 包括 (1)左外连接(左边的表不加限制) (2)右外连接(右边的表不加限制) (3)全外连接(左右两 ...
- ==与equal在java中应用的感悟
今天又算是长见识了.了解了下平时不注意的equal和==的区别. 不管是==又或是equal都是用来比较相同与否.当问题就在这里了,比较什么相同呢? 我的在日常的比较无非也就是两种:1.基本数据类型之 ...
- 网络编程中获取域名和id的方法
package com.lanqiao.java.test; import java.net.InetAddress;import java.net.UnknownHostException; pub ...
- poj2395 Out of Hay
题意就是给你一张无向连通图,试问对于图上所有点对(u,v)从u到v的所有路径中边权最大值的最小值的最大值. 定义f(u,v)表示从u到v所有路径中边权最大值的最小值,对所有点对取其最大. 实际上就是求 ...