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 ...
随机推荐
- small details
1.操作数据时,一般能入库就入库,或者用xml文件,用文件操作比较复杂
- php导出word格式数据的代码
<?php /** * 生成word文档的类 * by www.jbxue.com */ class word { function start() { ...
- x3270: PCOM的替代品
在Linux上登录Mainframe的利器,而且也是PCOM的免费版.原来没有仔细研究,今天花了一些时间学习,确实能满足基本的要求: x3270的Homepage 看一下Release Note, ...
- 有关OpenGL着色语言(一)
刚接触OpenGL着色语言...,不定期增加内容 1.OpenGL着色语言(GLSL)是什么? 用于OpenGL的面向过程的高级着色语言,是近年来图形编程领域中出现的最重要的新型开发技术,使用Open ...
- Inside TSQL Querying - Chapter 1. Logical Query Processing
Logical Query Processing Phases Summary (8) SELECT (9) DISTINCT (11) <TOP_specification> <s ...
- 【python cookbook】【字符串与文本】3.利用shell通配符做字符串匹配
问题:当工作在Linux shell下时,使用常见的通配符模式(即,*.py.Dat[0-9]*.csv等)来对文本做匹配 解决方案:fnmatch模块提供的两个函数fnmatch().fnmatch ...
- Can't create/write to file '/tmp/#sql_887d_0.MYD' (Errcode: 17)
lsof |grep "#sql_887d_0.MYD" 如果没有被占用就可以删掉 . https://wordpress.org/support/topic/cant-creat ...
- 2>&1 的用法说明
经常关注linux脚本的人,一定看到过 2>&1 这样的用法,最初一定不明白其中的含义以及为什么是这样的一种组合.昨天偶然间再次看到了这个 2>&1 的写法,遂下决心搞明白 ...
- xib托线出来的为什么是weak而不是strong
因为控件他爹( view.superview )已经揪着它的小辫了( strong reference ),你( viewController )眼瞅着( weak reference )就好了. 当 ...
- Linux hrtimer分析(2)
http://blog.csdn.net/angle_birds/article/details/17375901 本文介绍Linux2.6.29中,配置高精度模式的hrtimer与未配置高精度模式时 ...