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 ...
随机推荐
- yii2多语言
1.页面视图(我放在了布局文件main.php中): <a href="javascript:;" onclick="changeLanguage('zh-CN') ...
- sql插入删除表内字段基础操作
1 取得表格资讯 1.1 DESCRIBE指令 「DESCRIBE」是MySQL资料库提供的指令,它只能在MySQL资料库中使用,这个指令可以取得某个表格的结构资讯,它的语法是这样的: 你在MySQL ...
- 161117、使用spring声明式事务抛出 identifier of an instance of
今天项目组有成员使用spring声明式事务出现下面异常,这里跟大家分享学习下. 异常信息: org.springframework.orm.hibernate3.HibernateSystemExce ...
- sql server 关联更新
update a set a.name1 = b.name1, a.name2=b.name2from 表A a, 表B b where a.id=b.id
- Java中删除指定文件夹文件夹下面有内容也删除使用递归方案
import java.io.File; import java.text.ParseException; import java.text.SimpleDateFormat; import java ...
- maven打包异常
maven打包异常,如图: 问题原因:服务器密码错了.
- MYSQL的主从和主主复制模式
一.复制介绍 MySQL支持单向.异步复制,复制过程中一个服务器充当主服务器,而一个或多个其它服务器充当从服务器.主服务器将更新写入二进制日志文件,并维护文件的一个索引以跟踪日志循环.这些日志可以记录 ...
- java正则表达式四种常用的处理方式是怎么样呢《匹配、分割、代替、获取》
java 正则表达式高级篇,介绍四种常用的处理方式:匹配.分割.替代.获取,具体内容如下package test; import java.util.regex.Matcher; import jav ...
- PHP给图片加文字(水印)
准备工作: 代码: <?php header("Content-type: image/jpeg"); //浏览器输出,如不需要可去掉此行 $im = @imagecreat ...
- WPF:获取控件内的子项
一.界面内容(部分:仅供参考) <Window> <Window.Resources> <!--工具数据源--> <XmlDataProvider x:Key ...