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的更多相关文章

  1. Using GET_APPLICATION_PROPERTY in Oracle D2k Forms

    Using GET_APPLICATION_PROPERTY in Oracle D2k Forms DescriptionReturns information about the current ...

  2. DISPLAY_ITEM built-in in Oracle D2k Forms

    DISPLAY_ITEM built-in in Oracle D2k Forms DescriptionMaintained for backward compatibility only. For ...

  3. 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 ...

  4. 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 ...

  5. CHECKBOX_CHECKED built-in in Oracle D2k Forms

    CHECKBOX_CHECKED built-in in Oracle D2k Forms DescriptionA call to the CHECKBOX_CHECKED function ret ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. 高并发应用中客户端等待、响应时间的推算,及RT/QPS概念辨析

    高并发应用中客户端等待.响应时间的推算,及RT/QPS概念辨析 对于一个网站,已知服务端的服务线程数和处理单个请求所需的时间时,该如何算出高并发时用户从点击链接到收到响应的时间?注意这个时间并不等于服 ...

  2. NOIP201402比例化简

    比例化简 [问题描述]在社交媒体上,经常会看到针对某一个观点同意与否的民意调查以及结果.例如,对某一观点表示支持的有 1498 人,反对的有 902 人,那么赞同与反对的比例可以简单的记为1498:9 ...

  3. 影响SQL server性能的关键

    一.逻辑数据库和表的设计数据库的逻辑设计.包括表与表之间的关系是优化关系型数据库性能的核心.一个好的逻辑数据库设计可以为优化数据库和应用程序打下良好的基础.   标准化的数据库逻辑设计包括用多的.有相 ...

  4. Spring之AOP面向切片

       一.理论基础: AOP(Aspectoriented programming)面向切片/服务的编程,在Spring中使用最多的是对事物的处理.而AOP这种思想在程序中很多地方可以使用的,比如说, ...

  5. java运算符优先级记忆口诀

    尊重原创:(口诀)转自http://lasombra.iteye.com/blog/991662 今天看到<java编程思想>中的运算符优先级助记口诀,不过"Ulcer Addi ...

  6. linux内核中jiffies的回绕问题【转】

    本文转载自:http://blog.csdn.net/yuanlulu/article/details/6019862 ======================================== ...

  7. python两个 list 交集,并集,差集的方法+两个tuple比较操作+两个set的交集,并集,差集操作+两个dict的比较操作

    转自:http://blog.chinaunix.net/uid-200142-id-3992553.html 有时候,为了需求,需要统计两个 list 之间的交集,并集,差集.查询了一些资料,现在总 ...

  8. Java生产者消费者模型

    在Java中线程同步的经典案例,不同线程对同一个对象同时进行多线程操作,为了保持线程安全,数据结果要是我们期望的结果. 生产者-消费者模型可以很好的解释这个现象:对于公共数据data,初始值为0,多个 ...

  9. Majority Element

    #include<map> using namespace std;class Solution {public:    int majorityElement(vector<int ...

  10. WPF single instance

    转自:http://www.cnblogs.com/z_lb/archive/2012/09/16/2687487.html public partial class App : Applicatio ...