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. zw版【转发·台湾nvp系列Delphi例程】HALCON DirectFile

    zw版[转发·台湾nvp系列Delphi例程]HALCON DirectFile unit Unit1;interfaceuses Windows, Messages, SysUtils, Varia ...

  2. 【py网页】sitecopy代码

    001 #coding:utf-8 002 import re,os,shutil,sys 003 import urllib2,socket,cookielib 004 from threading ...

  3. js表单提交一种方式

    在一个html和php混编的文件中,用到js提交表单的方法: 定义表单id为form1,提交按钮type为submit, var data_info = document.getElementById ...

  4. MapReduce之Mapper类,Reducer类中的函数(转载)

    Mapper类4个函数的解析 Mapper有setup(),map(),cleanup()和run()四个方法.其中setup()一般是用来进行一些map()前的准备工作,map()则一般承担主要的处 ...

  5. MySQL函数汇总

    前言 MySQL提供了众多功能强大.方便易用的函数,使用这些函数,可以极大地提高用户对于数据库的管理效率,从而更加灵活地满足不同用户的需求.本文将MySQL的函数分类并汇总,以便以后用到的时候可以随时 ...

  6. 匹配 prev 元素之后的所有 siblings 元素

    描述: 找到所有与表单同辈的 input 元素 HTML 代码: <form> <label>Name:</label> <input name=" ...

  7. java总结第二次(剩余内容)//类和对象1

    7.成员变量和局部变量 成员变量:在类中定义,用来描述对象将要有什么 局部变量:在类的方法中定义,在方法中保存临时数据 区别:作用域不同 局部变量的作用域仅限于定义它的方法 成员变量的作用域在整个类内 ...

  8. ServiceStack.Redis之IRedisClient 03_转

    事实上,IRedisClient里面的很多方法,其实就是Redis的命令名.只要对Redis的命令熟悉一点就能够非常快速地理解和掌握这些方法,趁着现在对Redis不是特别了解,我也对着命令来了解一下这 ...

  9. 【Pro ASP.NET MVC 3 Framework】.学习笔记.12.ASP.NET MVC3的细节:URLs,Routing和Areas

    Adam Applied ASP.NET 4 in Context 1 介绍Routing系统 在引入MVC之前,ASP.NET假定被请求的URLs和服务器硬盘上的文件之间有着直接关系.服务器的任务是 ...

  10. webrtc - web 应用相关网站

    很有意思的网站 http://io13webrtc.appspot.com/#1 html5使用webrtc简介 http://www.html5rocks.com/en/tutorials/getu ...