Read/write to DB text file

Hello

What is the effective way of reading the text file and write to the DB table.

Forms Builder (10.2.0.3.0) - version
DB 10 g 2


Rgds


sexy

Hello

TEXT_IO is a software package, integrated forms. Webutil has too (but it's CLIENT_TEXT_IO, which can be read from the client computer), in which, plain TEXT_IO reads the file from the server computer.

As I said before, it depends on the number of records / size of the file. If he records little (say a few hundred), then you can go for TEXT_IO. However, if the size of the file is very high / you have more records (say thousands / millions), then SQL Loader is the best bet.

If you are worried about the performance (i.e. If you have more records to be inserted), you can create a batch script (which loads the data into tables using SQL Loader) and call the command script using the HOST of shapes command.

You can see the SQL Loader manual (which I gave the link before), for orders / check the syntax of the file etc and create a command script. Probably, if you're looking for the PL/SQL forum / forum SQL Loader, you will get more ideas and samples.

HTH.

Arun-

Tags: Oracle Development

Similar Questions

  • How to read/write tdms 2.0 files with the TDM C DLL?

    Hello

    How to read/write tdms 2.0 files with the TDM C DLL?

    How consequently the datas in interlaced with the TDM C DLL mode?

    Thank you

    Confirmation: TDM C DLL always wrote the file in TDMS version 2.0.

  • Need help: UTL_FILE read and write in the text file

    Hello, I'm on version 11 GR 2 by using the UTL_FILE function to read a text file and then write the lines where it starts with the word "foo" and put an end to my writing in the text file where the line with the word "ZEN". Now I have several lines that begin with 'foo' and 'ZEN' allow a paragraph, and in this paragraph, there is a line that begins with "DE4.2". Therefore,.
    I need to write all of the paragraphs that include the "DE4.2" line in their beginning and end of lines 'foo' and 'ZEN '.

    FOR EXAMPLE:

    FOO/234E53LLID
    IT'S MY SECOND LINE
    IT'S MY THIRD LINE
    DE4.2 IT OF MY FOURTH LINE
    IT'S MY FIFTH LINE
    ZEN/DING3434343

    FOO/234E53LLID
    IT'S MY SECOND LINE
    IT'S MY THIRD LINE
    IT'S MY FIFTH LINE
    ZEN/DING3434343

    I'm only interested in writing the first paragraph tha includes line DE4.2 in one of the paragraph of lines not the second ther that does not include the "DE4.2".

    Here is my code so far:

    CREATE OR REPLACE PROCEDURE my_app2 IS
    Utl_file.file_type INFILE;
    outfile utl_file.file_type;
    buffer VARCHAR2 (30000);
    b_paragraph_started BOOLEAN: = FALSE; -flag to indicate which required paragraph is started

    BEGIN
    -Open a file to read
    INFILE: = utl_file.fopen ('TEST_DIR', 'mytst.txt', 'r');
    -Opens a file for writing
    outfile: = utl_file.fopen ('TEST_DIR', "Out.txt", "w");

    -Check the file is open
    IF utl_file.is_open (infile)
    THEN
    -lines in the file in loop
    LOOP
    BEGIN
    UTL_FILE.get_line (infile, buffer);
    APPLICATION STARTING POINT-
    Buffer IF LIKE 'foo %' THEN
    b_paragraph_started: = TRUE;
    END IF;
    -SEARCH FOR GRADS APPS
    IF b_paragraph_started AND buffering LIKE '% 4% ' THEN
    UTL_FILE.put_line (outfile, buffer, FALSE);
    END IF;
    -REQUEST FOR ENDPOINT
    Buffer IF LIKE '% ZEN' THEN
    b_paragraph_started: = FALSE;
    END IF;
    UTL_FILE.fflush (outfile);

    EXCEPTION
    WHEN no_data_found THEN
    EXIT;
    END;
    END LOOP;
    END IF;
    UTL_FILE.fclose (INFILE);
    UTL_FILE.fclose (outfile);
    EXCEPTION
    WHILE OTHERS THEN
    raise_application_error ("-20099, ' UTL_FILE unknown error");
    END my_app2;
    /

    When I run this code I get only one line: DE4.2 it ME LACK THE WHOLE PARAGRAPH

    PLEASE ADVISE...

    I agree with reservations of Justin on the length of a "paragraph" and the number of users that are running at the same time, so here is a version without the collections.

    CREATE or replace PROCEDURE my_app2 IS
       infile utl_file.file_type;
       outfile utl_file.file_type;
       buffer VARCHAR2(30000);
       b_paragraph_started BOOLEAN := FALSE; -- flag to indicate that required paragraph is started
       b_toprint BOOLEAN := FALSE;
       l_para_start pls_integer;  -- start of "paragraph"
    BEGIN
       infile := utl_file.fopen('TEST_DIR', 'mytst.txt', 'r');
       outfile := utl_file.fopen('TEST_DIR', 'out.txt', 'w');
       LOOP
          BEGIN
             utl_file.get_line(infile, buffer);
             IF buffer LIKE 'FOO%' THEN
                b_paragraph_started := TRUE;
                l_para_start := UTL_FILE.FGETPOS(infile) - (length(buffer) + 1);
             END IF;
             IF b_paragraph_started and buffer like '%DE4%' THEN
                b_toprint := TRUE;
             END IF;
             If buffer like 'ZEN%' THEN
                IF b_toprint THEN
                   UTL_FILE.FSEEK(infile, l_para_start);
                   utl_file.get_line(infile, buffer);
                   while buffer not like 'ZEN%' loop
                      utl_file.put_line(outfile,buffer, FALSE);
                      utl_file.get_line(infile, buffer);
                   end loop;
                   utl_file.put_line(outfile,buffer, FALSE);
                end if;
                b_paragraph_started := FALSE;
                b_toprint := false;
                utl_file.fflush(outfile);
             end if;
          EXCEPTION
             WHEN no_data_found THEN
                EXIT;
             END;
       END LOOP;
       utl_file.fclose(infile);
       utl_file.fclose(outfile);
    END my_app2;
    

    Test:

    SQL> !cat mytst.txt
    FOO/234E53LLID
    THIS IS MY SECOND LINE
    THIS IS MY THIRD LINE
    DE4.2 THIS IS MY FOURTH LINE
    THIS IS MY FIFTH LINE
    ZEN/DING3434343
    
    FOO/234E53LLID
    THIS IS MY SECOND LINE
    THIS IS MY THIRD LINE
    THIS IS MY FIFTH LINE
    ZEN/DING3434343
    
    FOO/234E53LLID again
    THIS IS MY second SECOND LINE
    THIS IS MY second THIRD LINE
    DE4.2 THIS IS MY second FOURTH LINE
    THIS IS MY second FIFTH LINE
    ZEN/DING3434343 again
    
    SQL> exec my_app2;
    
    PL/SQL procedure successfully completed.
    
    SQL> !cat out.txt
    FOO/234E53LLID
    THIS IS MY SECOND LINE
    THIS IS MY THIRD LINE
    DE4.2 THIS IS MY FOURTH LINE
    THIS IS MY FIFTH LINE
    ZEN/DING3434343
    FOO/234E53LLID again
    THIS IS MY second SECOND LINE
    THIS IS MY second THIRD LINE
    DE4.2 THIS IS MY second FOURTH LINE
    THIS IS MY second FIFTH LINE
    ZEN/DING3434343 again
    

    You may need to change the length (buffer) + 1 depending on your platform and if you want a blank line s NLE out paragraphs, add another call to put_line after that outside of the loop in the fi l_toprint block.

    John

  • Write data to text file generates the error

    Hi all

    I need to write data to a file using TestStand and I configired the entrance and outside like below, but I get the error message like ' an error occurred 'Write' calling in 'ITextStream' of 'Microsoft Scripting Runtime' [error Code:-2146828234].

    I followed the same procedure for reading text that works very well for me.

    Hope others might have faced the problem / or I do something wrong.

    Do what is necessary.

    Found problem while opening a file I used IO Mode ForReading instead of ForWriting.

    Unnecessarily the thread created, but then hope this can help someone later when they deal with a particular issue.

  • Read a utf-8 text file

    Hi, until now, I used the default encoding for reading and writing text files, but I discovered it causes question marks trying to read or write the non-English characters, so I'm trying to change my code to use:

    inputstramreader and OutputStreamWriter inputreader and outputwriter, I have used before.

    However, I discovered the onlyworks linereader with InputStreamand not with inputstreamreader.

    also bufferedread is not available in api.

    It looks something like this:

    View linereader takes inputstream and not inputstreamreader.

              fc = (FileConnection) Connector.open(targetFolder + "file.txt", Connector.READ_WRITE);
                InputStream is = fc.openInputStream();
                InputStreamReader reader = new InputStreamReader(is, "UTF-8");
                String line = null;
                LineReader lineReader = new LineReader(is);
                try
                {
                    lineReader.readLine();  // skip header line
                    line = new String(lineReader.readLine());   // get line from file
                }
    

    so the question is, I have to manually write a function to read a line in the file? or is it an another workaround?

    You need to specify the encoding of the byte array and do not rely on the default encoding when you create a string to a byte array.

    Use this:

    line = new String(lineReader.readLine(), "UTF-8"));
    
  • Write to a text file

    Hi friends,

    I want to write an error in a text file using the procedure but its throwing an error below

    declare
    f utl_file.file_type;
    s varchar2 (200);
    Start
    f: = utl_file.fopen('C:\TEMP','NCW_ET15.log','W');
    loop
    UTL_FILE.put_line (f, s);
    dbms_output.put_line (s);
    end loop;
    exception
    When NO_DATA_FOUND then
    UTL_FILE.fclose (f);
    end;

    ==========

    Error report:
    ORA-29283: invalid file operation
    ORA-06512: at "SYS." UTL_FILE", line 536
    ORA-29283: invalid file operation
    ORA-06512: at line 5
    29283 00000 - "invalid file operation.
    * Cause: An attempt was made to read from a file or a directory which is
    not exist, or the file or directory access was denied by the
    Operating system.

    Any ideas how to solve this problem...

    Thank you
    Lony

    Hi Lony,

    You may not use the operating system directory here.

    You must create the directory object in oracle.

     
    
    create or replace directory temp_dir as 'C:\temp'; 
    
    grant read , write on directory temp_dir to hr; -- Username 
    

    To create any directory, 'create any directory of grant' privilege.

     
    
    declare
        f utl_file.file_type;
        s varchar2(200) := 'Line 1';
    begin
        f := utl_file.fopen('TEMP_DIR','NCW_ET15.log','W');
        utl_file.put_line(f,s);
        utl_file.fclose(f);
    exception
        when NO_DATA_FOUND then
    utl_file.fclose(f);
    end;
    /
    show errors 
    
  • Write in the text file on request

    Hello

    I've been struggling with the "write to text file" in the part of the attached .vi button

    I want to be able to say my program when I press on the Boolean key it should collect 1 sample point only from the mean.vi - now that I managed to do a Boolean-button that starts the collection of data and then I have to press the button again when I 'think' now, I collected a data point using the structure of the case.

    Can someone help me to collect the data a not that when I press the Boolean?

    Thank you!

    Change the mechanical action of the key "lock when released.  It is an option to right click on the button on the front panel.

  • Can all help with VI to get data (HEX) serial number and write in the text file

    Hello I am struggling with this problem for 2 months... They get help from different I thought I solved the problem, but of no use yet I stand on zero

    Problem: I need to get data on USB high speed HEXAGON shaped (coming in hexadecimal and be stored in the text file to the hexadecimal format as each hexadecimal value online different I'll also to attach the file)

    Get us ASCII on series or VISA read but when trying to convert to hex as shown in text file making it slower to deal with code, I know that my VI will have to improve more... I'm waiting for suggestions

    Need urgent help...

    Thanks in advance

    Hi Ali Afzal,.

    I think that the attached example can work for you. If not, then try the solution with sending the data to a parallel running the loop and store it there.

    Mike

  • How to catch exceptions and write in the text file

    For all developers,.

    This is the problem,

    I want to print my exception stack trace in a text file.

    This developer can know and analyze on what function is error and what exception for this error...

    Is it possible to do this?

    Thank you...

    Yes, you can write like try (), it returns a string, and you can write that string to the file.

  • OMBPlus - TCL - reading variables out of text file

    Hello

    I want to read a text file variables.

    For example to connect

    OMBCONNECT $login/$pass@$host:1522:$service

    and these 4 variables in a text file.

    I'm a newbie, so this might be a stupid question


    Thank you!

    use

    OMBCC ' / / $i / / $I

    It's the double slash

    Published by: Katia on March 10, 2010 09:17

    Published by: Katia on March 10, 2010 09:21

  • How can I write to a text file without deleting the previous content

    I am Luis

    Code:

    FileConnection conn = (FileConnection) connector
    . Open ("file:///sdcard/xxx/Read");
    If (! conn.exists ()) {}
    Conn.Create ();
    }
    If (conn.exists () & conn.fileSize () == 0) {}
    OutputStream out = conn.openOutputStream ();
    String incroversa_message = "text";
    out. Write (Text);
    out. Write (Text);
    out. Write (Text);
    out. Write (Text);
    out. Write ((Text));
    out. Write (Text);
    out. Write (Text);
    out. Close();
    Conn.Close ();
    }

    The work of code but the problem is that when I try to make another entry erases the previous and write new writing.

    Thank you.

    Solution 2...

    read the file and get the content. then write the file with the content + new content

    or you could get the content of the file and add it with new content

  • Read data from a text file

    Hi, using Cp 8.01.

    I would like to read the textual data to a text or XML file into a variable in order to display a message (using a form) on my project of Cp can I do this without using Javascript?

    Thank you.

    You need JS.

  • Three sets of data to write to a text file

    Hello

    I think it will be a simple problem, but I'm stuck with it.

    If someone could be so kind as to show me how to put 3 sets of data: V-time, parcel SPD, V ^ 2-time on vi, in a single txt file (to be used on a worksheet).

    Please find attached vi.

    Thank you.


  • How to write data in text file

    Hello

    When I save the following code in a package as a procedure.
    He made a mistake

    (1): PLS-00201: identifier ' TEXT_IO. Type_de_fichier ' must be declared



    code
    ===

    PROCEDURE prc_writefile
    (v_fname IN VARCHAR2,
    v_input1 IN VARCHAR2,
    v_input2 VARCHAR2)
    IS

    linebuf VARCHAR2 (5);
    in_file Text_IO.file_type;
    OUT_FILE Text_IO.file_type;

    BEGIN
    -print
    OUT_FILE: = Text_IO.fopen('C:\saved_log.txt','a');
    Text_IO. Put_line (' out_file,' updated a file ' |' test data ');
    Text_IO.fclose (OUT_FILE);


    EXCEPTION
    WHILE others THEN
    MESSAGE(SQLERRM||) e '|| SQLCODE);
    END;

    END;


    ===========


    How to reach the Text_IO package built to this


    Rgds

    sexy

    Vanessa,

    Text_io is built in package provided with Oracle Forms but not db. If you need manage files db level, use utl_file.

    Thank you
    Raja.

  • How to get two strings to write to a text file

    As requested above.

    Attached is the peak of the problem I have

    Thank you

    Sorry I'm new to Labview

    Concatenate string

    Please take the free tutorials or categories of LabVIEW (free with purchase). It's Basic.

Maybe you are looking for

  • Satellite Pro U400 - 15 p hangs after enabling the Realtek RTL8187B WLan card

    Hello I recently bought the Toshiba Satellite Pro u400 - 15 p. This notebook is originally without any operating system included. I installed Windows XP Home SP3 on it and downloaded all the drivers from the Web from Toshiba website. Everything works

  • Slow to recover messages from a single e-mail account

    Hi all, this is probably an easy fix, but not when I don't know what to do. Haha! I have multiple e-mail accounts, and e-mails come my MacBook Pro very well all my accounts except one. Unfortunately, that one of my business Web site hosted by GoDaddy

  • C855 satellite won't stop beeping

    Hello Can someone please? My laptop started randomly beeps, then it beeps constantly. As it has a mind of its own! The sound his mute on yet, it still sounds.Someone knows what it is please? Didn't have laptop 2 months! Thanks in advance!

  • How IMAQ to convert pixel to work in the real world?

    Hello I wonder how IMAQ to convert pixel to work in the real world? See the example for vision Calibration.vi Simple, is the actual formula used by "IMAQ convert from pixel to the real world" will receive the axis (mm) calibration of the axis of the

  • Media player controls

    Hello is there a way to implement the player controls (play, pause, stop,...) as those used in the drive multimedia blackberry shipped for use with the Player object? More in detail, how can I show/hide commands? Pushing another transparent screen co