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 ...
随机推荐
- android 百度地图定位开发1
首先注册成为百度开发者 然后进入百度开发者中心 点击LBS 跳到下一个页面 点击Android 开发 里面的基础地图 进入 点击获取密钥 进入 点击创建应用 进入 应用名称自己填 应用类 ...
- yum安装mysql后没有mysqld
在Centos中用命令 yum install mysql安装数据库,但装完后运行mysqld启动mysql的时候提示找不到,通过 find / | grep mysqld 也没找到mysqld的目录 ...
- Mac下使用Automator实现隐藏和显示
本文使用Makdown编辑 通常系统中打开一个文件有好多种方法,编辑也是.例如你要打开OmniGraffle来画个图(suppose you are working on the Mac OS X) ...
- Linux workqueue疑问【转】
转自:http://blog.csdn.net/angle_birds/article/details/9387365 各位大神,你们好.我在使用workqueue的过程中遇到一个问题. 项目采用uC ...
- Http的常见问题
A: HTTP(超文本传输协议)是一个基于请求与响应模式的.无状态的.应用层的协议. B: 文件传输协议FTP.电子邮件传输协议SMTP.域名系统服务DNS.HTTP协议等都同是应用层协议. C:HT ...
- Java URLClassLoader和ClassLoader
开始:看名字都带有ClassLoader,叫做类加载器,事实上是可以理解为动态的加载类,不过,也不是只能加载类,也可以加载其他形式的文件,比如说.properties属性文件. 区别:其实在两个类加载 ...
- get/post方式调用http接口
http://www.cnblogs.com/java-pan/tag/HTTP/ http://www.cnblogs.com/snoopylovefiona/p/4730242.html(可做参考 ...
- [已解决] java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.com.yourproject.test_jsp
同事遇到了一个问题,开始项目运行的好好的,过了一段时间再访问页面会报出如下错误信息(只贴了部分), 这是为啥呢,可能是由于servlet-api版本jar包重复导致的,他项目本身使用了servlet- ...
- Java四种线程池newCachedThreadPool,newFixedThreadPool,newScheduledThreadPool,newSingleThreadExecutor
1.new Thread的弊端 执行一个异步任务你还只是如下new Thread吗? Java new Thread(new Runnable() { @Override public void ru ...
- [C++]C++标准里 string和wstring
typedef basic_string<char> string; typedef basic_string<wchar_t> wstring; 前者string是常用类型, ...