Importing data from a text file into a table

Hi Experts,
I have the following flat file
weekly_eft_repo  1.0                                                                                                       Page: 1
CDC:00304 / Sat Oct-31-2009     Weekly EFT Sweep for 25/10/09 - 31/10/09  Effective Date 03/11/09         Sat Oct-31-2009 22:06:14
Bill to
Retailer Retailer Name                  Name on Bank Account           Bank ABA   Bank Acct            On-line Amount  Instant Amount  Total Amount
======== ============================== ============================== ========== ==================== =============== =============== ===============
0200101 Triolet Popular Store          Triolet Popular Store          111111111  62030100130659            10,868.00            0.00       10,868.00
0200103 Le Cacharel Snack              Le Cacharel Snack              111111111  62030100130813             9,728.00            0.00        9,728.00
0200104 Advanced Co-operative Self Ser Advanced Co-operative Self Ser 111111111  111111111                  7,334.00            0.00        7,334.00
0200105 Chez Popo Supermarket          Chez Popo Supermarket          111111111  61030100044898            30,932.00            0.00       30,932.00
0200106 Vana Supermarket               Vana Supermarket               111111111  111111111                 17,775.00            0.00       17,775.00
0200107 Mont Choisy Store              Mont Choisy Store              111111111  62030100130804             8,840.00            0.00        8,840.00
0200108 Vijay Store                    Vijay Store                    111111111  62030100131229            16,416.00            0.00       16,416.00
0200109 Neptune Confection             Neptune Confection             111111111  62030100130931            11,077.00            0.00       11,077.00
0200110 Antoine Store                  Antoine Store                  111111111  111111111                  2,470.00            0.00        2,470.00
0200111 P.S.C Cold Storage             P.S.C Cold Storage             111111111  111111111                 10,431.00            0.00       10,431.00
0200113 Mini Prix Boutique             Mini Prix Boutique             111111111  62030100131501            26,315.00            0.00       26,315.00
0200114 Hotel Cassim                   Hotel Cassim                   111111111  111111111                135,147.00            0.00      135,147.00
0200116 Aman Snack                     Aman Snack                     111111111  62030100129481             7,334.00            0.00        7,334.00
0200117 Best For Less Company Ltd      Best For Less Company Ltd      111111111  111111111                  3,325.00            0.00        3,325.00
0200118 Central Way                    Central Way                    111111111  111111111                 25,137.00            0.00       25,137.00I need to insert the data it contains into the following table
TABLE weekly_eft_report_temp
Name                                      Null?    Type                       
BILL_TO_RETAILER                          NOT NULL VARCHAR2(15)               
RETAILER_NAME                                      VARCHAR2(100)              
NAME_ON_BANK_ACCOUNT                               VARCHAR2(100)              
BANK_ABA                                           VARCHAR2(1)                
BANK_ACCT                                          VARCHAR2(1)                
ON_LINE_AMOUNT                                     NUMBER                     
INSTANT_AMOUNT                                     NUMBER                     
TOTAL_AMOUNT                                       NUMBER Whats the easiest and best way to proceed on that?
Thanks
Kevin

I am with Chris on this one.
If those headers are repeating in your text file, you could run a simple script to cleanse the data first and make the file fit for SQL*Loader.
Here's an example with Perl, I hope the header of Page 2 and onwards resembles what you have in your file. I've snipped some data from the far right so that it fits on my terminal screen:
$
$ # show the contents of the data file
$
$ cat report.dat
weekly_eft_repo  1.0                                                                                        Page: 1
CDC:00304 / Sat Oct-31-2009 Weekly EFT Sweep for 25/10/09 - 31/10/09  Effective Date 03/11/09 Sat Oct-31-2009 22:06:14
Bill to
Retailer Retailer Name                  Name on Bank Account           Bank ABA   Bank Acct            On-line Amount
======== ============================== ============================== ========== ==================== ===============
0200101 Triolet Popular Store          Triolet Popular Store          111111111  62030100130659            10,868.00
0200103 Le Cacharel Snack              Le Cacharel Snack              111111111  62030100130813             9,728.00
0200104 Advanced Co-operative Self Ser Advanced Co-operative Self Ser 111111111  111111111                  7,334.00
0200105 Chez Popo Supermarket          Chez Popo Supermarket          111111111  61030100044898            30,932.00
0200106 Vana Supermarket               Vana Supermarket               111111111  111111111                 17,775.00
weekly_eft_repo  1.0                                                                                        Page: 2
CDC:00304 / Sat Oct-31-2009 Weekly EFT Sweep for 25/10/09 - 31/10/09  Effective Date 03/11/09 Sat Oct-31-2009 22:06:14
Bill to
Retailer Retailer Name                  Name on Bank Account           Bank ABA   Bank Acct            On-line Amount
======== ============================== ============================== ========== ==================== ===============
0200107 Mont Choisy Store              Mont Choisy Store              111111111  62030100130804             8,840.00
0200108 Vijay Store                    Vijay Store                    111111111  62030100131229            16,416.00
0200109 Neptune Confection             Neptune Confection             111111111  62030100130931            11,077.00
0200110 Antoine Store                  Antoine Store                  111111111  111111111                  2,470.00
0200111 P.S.C Cold Storage             P.S.C Cold Storage             111111111  111111111                 10,431.00
weekly_eft_repo  1.0                                                                                        Page: 3
CDC:00304 / Sat Oct-31-2009 Weekly EFT Sweep for 25/10/09 - 31/10/09  Effective Date 03/11/09 Sat Oct-31-2009 22:06:14
Bill to
Retailer Retailer Name                  Name on Bank Account           Bank ABA   Bank Acct            On-line Amount
======== ============================== ============================== ========== ==================== ===============
0200113 Mini Prix Boutique             Mini Prix Boutique             111111111  62030100131501            26,315.00
0200114 Hotel Cassim                   Hotel Cassim                   111111111  111111111                135,147.00
0200116 Aman Snack                     Aman Snack                     111111111  62030100129481             7,334.00
0200117 Best For Less Company Ltd      Best For Less Company Ltd      111111111  111111111                  3,325.00
0200118 Central Way                    Central Way                    111111111  111111111                 25,137.00
$
$
$ # snip off the headers using Perl so that the transformed file has just the data to load
$
$ perl -lne 'BEGIN{$/=""} s/^weekly.*?=\n//msg; print' report.dat
0200101 Triolet Popular Store          Triolet Popular Store          111111111  62030100130659            10,868.00
0200103 Le Cacharel Snack              Le Cacharel Snack              111111111  62030100130813             9,728.00
0200104 Advanced Co-operative Self Ser Advanced Co-operative Self Ser 111111111  111111111                  7,334.00
0200105 Chez Popo Supermarket          Chez Popo Supermarket          111111111  61030100044898            30,932.00
0200106 Vana Supermarket               Vana Supermarket               111111111  111111111                 17,775.00
0200107 Mont Choisy Store              Mont Choisy Store              111111111  62030100130804             8,840.00
0200108 Vijay Store                    Vijay Store                    111111111  62030100131229            16,416.00
0200109 Neptune Confection             Neptune Confection             111111111  62030100130931            11,077.00
0200110 Antoine Store                  Antoine Store                  111111111  111111111                  2,470.00
0200111 P.S.C Cold Storage             P.S.C Cold Storage             111111111  111111111                 10,431.00
0200113 Mini Prix Boutique             Mini Prix Boutique             111111111  62030100131501            26,315.00
0200114 Hotel Cassim                   Hotel Cassim                   111111111  111111111                135,147.00
0200116 Aman Snack                     Aman Snack                     111111111  62030100129481             7,334.00
0200117 Best For Less Company Ltd      Best For Less Company Ltd      111111111  111111111                  3,325.00
0200118 Central Way                    Central Way                    111111111  111111111                 25,137.00
$
$ You could do an inline substitution with Perl, or redirect it to a temp file and then move back to the original file. In either case, you have just the relevant data for the next step.
Again, Perl is just one option. On Unix/Linux systems, you have a large number of utilities/scripting languages that can perform almost any kind of data transformation.
HTH,
isotope

Similar Messages

  • How to import data from a text file into a table

    Hello,
    I need help with importing data from a .csv file with comma delimiter into a table.
    I've been struggling to figure out how to use the "Import from Files" wizard in Oracle 10g web-base Enterprise Manager.
    I have not been able to find a simple instruction on how to use the Wizard.
    I have looked at the Oracle Database Utilities - Overview of Oracle Data Pump and the Help on the "Import: Files" page.
    Neither one gave me enough instruction to be able to do the import successfully.
    Using the "Import from file" wizard, I created a Directory Object using the Create Directory Object button. I Copied the file from which i needed to import the data into the Operating System Directory i had defined in the Create Directory Object page. I chose "Entire files" for the Import type.
    Step 1 of 4 is the "Import:Re-Mapping" page, I have no idea what i need to do on this page. All i know i am not tying to import data that was in one schema into a different schema and I am not importing data that was in one tablespace into a different tablespace and i am not R-Mapping datafiles either. I am importing data from a csv file.
    For step 2 of 4, "Import:Options" page, I selected the same directory object i had created.
    For step 3 of 4, I entered a job name and a description and selected Start Immediately option.
    What i noticed going through the wizard, the wizard never asked into which table do i want to import the data.
    I submitted the job and I got ORA-31619 invalid dump file error.
    I was sure that the wizard was going to fail when it never asked me into which table do i want to import the data.
    I tried to use the "imp" utility in command-line window.
    After I entered (imp), i was prompted for the username and the password and then the buffer size as soon as i entered the min buffer size I got the following error and the import was terminated:
    C:\>imp
    Import: Release 10.1.0.2.0 - Production on Fri Jul 9 12:56:11 2004
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Username: user1
    Password:
    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
    tion
    With the Partitioning, OLAP and Data Mining options
    Import file: EXPDAT.DMP > c:\securParms\securParms.csv
    Enter insert buffer size (minimum is 8192) 30720> 8192
    IMP-00037: Character set marker unknown
    IMP-00000: Import terminated unsuccessfully
    Please show me the easiest way to import a text file into a table. How complex could it be to do a simple import into a table using a text file?
    We are testing our application against both an Oracle database and a MSSQLServer 2000 database.
    I was able to import the data into a table in MSSQLServer database and I can say that anybody with no experience could easily do an export/import in MSSQLServer 2000.
    I appreciate if someone could show me how to the import from a file into a table!
    Thanks,
    Mitra

    >
    I can say that anybody with
    no experience could easily do an export/import in
    MSSQLServer 2000.
    Anybody with no experience should not mess up my Oracle Databases !

  • How to do import data from the text file into the mathscript window?

    Could anyone tell me how to do import data from text file into mathscript window for labview 8?
    MathScript Window openned, File, Load Data - it has options: custom pattern (*.mlv) or all files. 
    Thanks

    Hi Milan,
    Prior to loading data in Mathscript Window , you have to save the data from the Mathscript window (the default extension of the file is .mlv but you can choose any extension). This means that you cannot load data from a text file  that was not created using the Mathscript window.
    Please let me know if you have any further questions regarding this issue.
    Regards,
    Ankita

  • How can I import data from a csv file into databse using utl_file?

    Hi,
    I have two machines (os is windows and database is oracle 10g) that are not connected to each other and both are having the same database schema but data is all different.
    Now on one machine, I want to take dump of all the tables into csv files. e.g. if my table name is test then the exported file is test.csv and if the table name is sample then csv file name is sample.csv and so on.
    Now I want to import the data from these csv files into the tables on second machine. if I've 50 such csv files, then data should be written to 50 tables.
    I am new to this. Could anyone please let me know how can I import data back into tables. i can't use sqlloader as I've to satisfy a few conditions while loading the data into tables. I am stuck and not able to proceed.
    Please let me know how can I do this.
    Thanks,
    Shilpi

    Why you want to export into .csv file.Why not export/import? What is your oracle version?
    Read http://www.oracle-base.com/articles/10g/oracle-data-pump-10g.php
    Regards
    Biju

  • How do you read data from a text file into a JTextArea?

    I'm working on a blogging program and I need to add data from a text file named messages.txt into a JTextArea named messages. How do I go about doing this?

    Student_Coder wrote:
    1) Read the file messages.txt into a String
    2) Initialize messages with the String as the textSwing text components are designed to use Unix-style linefeeds (\n) as line separators. If the text file happens to use a different style, like DOS's carriage-return+linefeed (\r\n), it needs to be converted. The read() method does that, and it saves the info about the line separator style in the Document so the write() method can re-convert it.
    lethalwire wrote:
    They have 2 different ways of importing documents in this link:
    http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html
    Neither of those methods applies to JTextAreas.

  • Adding data from a text file into a JTextArea

    I'm working on a blogging program and I need to add data from a text file named messages.txt into a JTextArea named messages. How do I go about doing this?

    then you need to be more specific in what you need help with because those are two commonly used options for reading data in from a file. what have you tried? where is your code failing? what kind of errors are you getting? of course it looks like others in the forum have already reprimanded you for failing to post properly.
    i have used both FileReader and the nio package for cfg and ini files which are both just txt files as well as massive data files. so tell me how they dont help you?

  • How to get data of tabulated text file into internal table

    hi all,
    i want to get data from tabulated text file(notepad) into internal table. i searched in SCN and got lot of post regarding  how to convert excel file into internal table but i didnt get posts regarding text file.
    thanks
    SAchin

    try:
    DATA: BEGIN OF tabulator,
            x(1) TYPE x VALUE '09',
          END OF tabulator.
      READ DATASET file INTO wa.
    split wa at tabulator into table itab.
    A.

  • Reading data from a text file into PAS - Dimension member names truncated

    Hi,
    I created a procedure to dump variables and data into a text file to load into another model. I used a semicolon as a field seperator.
    The data, measures and dimension members are dumped properly into a text file and no dimension member names are truncated .
    However when I read the data into  a measure, and I issue a peek command, dimension meber names are read in truncated
    and remain full names in the text file. Any reason for this? What do I need to do to prevent this from happening?
    THanks.
    Lungile

    Hi Lungile,
    The problem that you're likely having is that you haven't created a file description for the file from which you're reading.  When loading data into Application Server from a text file, you would normally go through three steps:
    1. Enter the ACCESS EXTERNAL subsystem
    2. Specify the name of the file to be read
    3. Specify the format of the file field names, types, widths, and positions.
    If you go into the Application Server help, select "Application Server Help", then "Application Server at the command level", then "Variables and reading in data", and then "Reading an external file", you will have the process of the steps you need to follow outlined for you, including links to the help topic for each command you need to issue.
    So what I think you need to do is use the DESCRIPTION command to specify the names of your fields, their type, and also their width, in order to ensure no truncation of data on the load.
    The same DESCRIPTION statement is required if you want to use your text file as the source of a dimension.
    Hope this helps,
    Robert

  • Writing from a text file into a table

    Hi,
    I have a problem with dearchiving the data from the txt file to the respective table.
    The table name is dynamic & I get the required columns from all_tab_columns.
    I use UTL_FILE.GET_LINE() to get the data one line at a time and INSTR() & SUBSTR() to break them into the respective columns.
    My dynamic insert contains a set of bind variables equal to the no. of columns of the table.
    The statement gets constructed correctly but I tried to use execute_immediate , i realised that i cannot construct the USING clause for it & hence I switced to DBMS_SQL.
    The DBMS_SQL.BIND_VARIABLE() binds all of the bind variables to a table of varchar2. I've taken care to convert the date & the number variables while binding.
    When i do DBMS_SQL.EXECUTE() I get the error,
    ORA-01008 Not all variables bound .
    I don't know the reason since the no. of bind variables & the no. of table variables are the same & the value in the table looks fine too!
    Could this be a date issue ??? am using the default format DD-MON-YY both to write to the text file and to read from it.
    Any help would be appreciated.
    thx
    kalpana
    Part of the code :
    Begin
    destination_file := upper(p_table_name)||'_ARCH'||to_char
    (p_process_date,'yyyymmdd')||'.dat';
    dbms_output.put_line(destination_file);
    file_id := UTL_FILE.FOPEN(file_path, destination_file,'r');
    -- Get the number of columns in the table to be archived
    select count(column_name)
    into col_ctr
    from all_tab_columns
    where table_name = upper(p_table_name)
    order by column_name;
    sql_stmt1 := 'Insert into '||p_table_name||'(';
    sql_stmt2 := ' values(';
    For col_rec in column_cur loop
    if col_ctr = column_cur%rowcount then -- last column in
    the select statement
    sql_stmt1 := sql_stmt1 || col_rec.column_name;
    sql_stmt2 := sql_stmt2||':b'||column_cur%rowcount;
    else
    sql_stmt1 := sql_stmt1 || col_rec.column_name ||',';
    sql_stmt2 := sql_stmt2||':b'||column_currowcount||',';
    end if;
    type_rec(column_cur%rowcount) := col_rec.data_type;
    end loop;
    sql_stmt1 := sql_stmt1||')';
    sql_stmt2 := sql_stmt2||')';
    sql_stmt := sql_stmt1||sql_stmt2;
    loop
    Begin
    UTL_FILE.GET_LINE(file_id,v_column_value);
    For i in 1..col_ctr loop
    v_next_position := INSTR(v_column_value,';',1,i);
    if i = 1 then
    v_rec(i) := SUBSTR(v_column_value, v_prev_position, v_next_position - 1);
    elsif i = col_ctr then -- last but one column
    v_rec(i) := SUBSTR(v_column_value, v_prev_position);
    else
    v_rec(i) := SUBSTR(v_column_value, v_prev_position, (v_next_position - v_prev_position));
    end if;
    v_prev_position := v_next_position + 1;
    end loop;
    v_cursor := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(v_cursor, sql_stmt, dbms_sql.native);
    For i in 1..col_ctr loop
    if type_rec(i) = 'DATE' then
    DBMS_SQL.BIND_VARIABLE(v_cursor,':b'||i, to_date(v_rec(i),'DD-MON-YY'));
    elsif type_rec(i) = 'NUMBER' then
    DBMS_SQL.BIND_VARIABLE(v_cursor,':b'||i, to_number(v_rec(i)));
    end if;
    end loop;
    -- Insert the row into the history table
    -- execute immediate sql_stmt USING value(v_rec);
    v_dummy := DBMS_SQL.EXECUTE(v_cursor);
    if SQL%NOTFOUND then
    dbms_output.put_line('CPN_HISTORY_ARCHIVE_PKG.DEARCHIVE_DATA : No records to insert');
    end if;
    Exception -- for UTL_FILE.GET_LINE
    when NO_DATA_FOUND then
    DBMS_SQL.CLOSE_CURSOR(v_cursor);
    UTL_FILE.FCLOSE(file_id);
    exit;
    End;
    end loop; -- end of loop for UTL_FILE.GET_LINE
    DBMS_SQL.CLOSE_CURSOR(v_cursor);
    UTL_FILE.FCLOSE(file_id);

    your program is currect except u r not building bind variables for varchar2 columns
    declare
    type tab133 is table of varchar2(4000) index by binary_integer;
    file_id utl_file.file_type;
    sql_stmt1 varchar2(1000);
    sql_stmt2 varchar2(1000);
    v_column_value varchar2(1000);
    sql_stmt varchar2(2000);
    col_ctr number:=0;
    p_table_name varchar2(30):='emp1';
    cursor column_cur is select column_name,data_type from user_tab_columns
    where table_name=upper(p_table_name);
    mainstr      VARCHAR2(40)          :=      '';
    splitstr      VARCHAR2(30)          :=     '';
    l_count      NUMBER(20)          :=     1;
    itr_count      NUMBER(20)          :=     0;
    processed      BOOLEAN               :=     FALSE;
    v_rec tab133;
    type_rec tab133;
    v_cursor integer;
    column_currowcount number;
    v_dummy number:=0;
    Begin
    --dbms_output.put_line(destination_file);
    file_id := UTL_FILE.FOPEN('c:\suresh', 'emp.txt','r');
    -- Get the number of columns in the table to be archived
    select count(column_name)
    into col_ctr
    from user_tab_columns
    where table_name = upper(p_table_name)
    order by column_name;
    sql_stmt1 := 'Insert into '||p_table_name||'(';
    sql_stmt2 := ' values(';
    For col_rec in column_cur loop
    if col_ctr = column_cur%rowcount then
    sql_stmt1 := sql_stmt1 || col_rec.column_name;
    sql_stmt2 := sql_stmt2||':b'||column_cur%rowcount;
    else
    sql_stmt1 := sql_stmt1 || col_rec.column_name ||',';
    sql_stmt2 := sql_stmt2||':b'||column_cur%rowcount||',';
    end if;
    type_rec(column_cur%rowcount) := col_rec.data_type;
    end loop;
    sql_stmt1 := sql_stmt1||')';
    sql_stmt2 := sql_stmt2||')';
    sql_stmt := sql_stmt1||sql_stmt2;
    dbms_output.put_line(sql_stmt);
    loop
    Begin
    UTL_FILE.GET_LINE(file_id,v_column_value);
         itr_count      :=     0;
         l_count :=1;
         processed     :=     FALSE;
    mainstr:=v_column_value;
         LOOP
              itr_count     :=      itr_count+1;
              IF instr(mainstr,',',1,itr_count)>0 THEN
                   splitstr      :=     SUBSTR(mainstr,l_count,(INSTR(mainstr,',',1,itr_count)-l_count));
                   l_count          :=     INSTR(mainstr,',',1,itr_count)+1;
              ELSE
                   splitstr      :=      SUBSTR(mainstr,l_count,LENGTH(mainstr)+1-l_count);
                   processed     :=     TRUE;
              END IF;
              v_rec(itr_count):=splitstr;
              IF processed THEN
                   EXIT ;
              END IF;
         END LOOP;
    v_cursor := DBMS_SQL.OPEN_CURSOR;
    --dbms_output.put_line(col_ctr);
    DBMS_SQL.PARSE(v_cursor, sql_stmt, dbms_sql.native);
    For i in 1..col_ctr loop
    if type_rec(i) = 'DATE' then
    DBMS_SQL.BIND_VARIABLE(v_cursor,':b'||to_char(i), to_date(v_rec(i),'DD/mm/yyyy'));
    elsif type_rec(i) = 'NUMBER' then
    DBMS_SQL.BIND_VARIABLE(v_cursor,':b'||to_char(i), to_number(v_rec(i)));
    elsif type_rec(i) = 'VARCHAR2' then
    DBMS_SQL.BIND_VARIABLE(v_cursor,':b'||to_char(i), v_rec(i));
    end if;
    end loop;
    v_dummy := DBMS_SQL.EXECUTE(v_cursor);
    if SQL%NOTFOUND then
    dbms_output.put_line('CPN_HISTORY_ARCHIVE_PKG.DEARCHIVE_DATA : No records to insert');
    end if;
    DBMS_SQL.CLOSE_CURSOR(v_cursor);
    Exception
    when NO_DATA_FOUND then
    UTL_FILE.FCLOSE(file_id);
    exit;
    End;
    end loop;
    UTL_FILE.FCLOSE(file_id);
    EXCEPTION
    when others then
    dbms_output.put_line(sqlerrm);
         UTL_FILE.FCLOSE(file_id);
    END;
    TEST:
    SQL> DESC EMP1
    Name Null? Type
    ENAME VARCHAR2(15)
    SUBJ VARCHAR2(15)
    SDATE DATE
    DATA FILE:
    AABC,oracle,08/08/2001
    xyz,social,12/12/2001
    SQL> select * from emp1;
    ENAME SUBJ SDATE
    AABC oracle 08/08/2001 00:00:00
    xyz social 12/12/2001 00:00:00

  • Loading the data from a text file to a table using pl/sql

    Hi Experts,
    I want to load the data from a text (sample1.txt) file to a table using pl/sql
    I have used the below pl/sql code
    declare
    f utl_file.file_type;
    s varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    loop
    utl_file.get_line(f,s);
    insert into sampletable (a,b,c) values (s,s,s);
    c := c + 1;
    end loop;
    exception
    when NO_DATA_FOUND then
    utl_file.fclose(f);
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;
    and my sample1.txt file looks like
    1
    2
    3
    The data is getting inserted, with below manner
    select * from sampletable;
    A     B     C
    1     1     1
    2     2     2
    3     3     3
    I want the data to get inserted as
    A     B     C
    1     2     3
    The text file that I have is having three lines, and each line's first value should go to each column
    Please help...
    Thanks

    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;SY.

  • Importing data from a text file with MathScript

    Hi,
    I currently have a bit of Matlab code that imports a load of data from a tab-delimited text file. The text file is in the same directory as the .m file and my .vi file. The relevant line of import code from Matlab is:
    data=dlmread('data.txt','\t',5,0);
    When I run this in Labview after importing the code into a Mathscript block and connecting two relevant outputs to a "Build XY Graph" block such that the variables can be plotted, I get a message saying:
    "Error -90001 occured at Error in function dlmread at line 10. Labview: File not found..." 
    How can I get LabVIEW to read the file? Sorry if this is a stupid question but I'm new to LabVIEW, having come from Matlab! 
    Thanks for the help  

    Hi,
    Looks like that you are using relative path. Then, the file must be located in MathScript search path. Otherwise, MathScript can not find that file. You can either specify the absolute path or add the path to MathScript search path list.
    I have tried in LabVIEW 8.6. dlmread should work well to read data from .txt file.

  • How to import data from a text file through DTS to Sql Server

    Please don't mistake me as i'm a new comer to sql server,please help me.
    how to import the data present in a plain text file through DTS into sql server and store the data in a temporary table.
    How far the temporary table is stored in the database.
    Please reply me as soon as possible.
    Thank you viewers.

    >
    I can say that anybody with
    no experience could easily do an export/import in
    MSSQLServer 2000.
    Anybody with no experience should not mess up my Oracle Databases !

  • Importing data from a text file

    I have a text file with two columns, one with dates (i.e. 2011-01-01) and the other with numbers that I'd like to show up on the calendar for that date (there's an entry for every day of the year). Is there a way to read in the text file and tell iCal to print the number associated with each date on the calendar? For example, if I've got the monthly view up, I'd like the number associated with each date in the table to be displayed beneath the date.

    It's a text file, so you'll want to read the file with a Reader. Each record is a line, so you can read the data with the readLine method. The fields are fixed-length, so you can use String.substring to read the data from each of the fields.

  • Is there away to load data from a text file to a table?

    I have data stored in filename.txt and I want to load those data into a table on the front pannel of vi. How can I do that?

    Se;
    If the text file is already in an spreadsheet format, you can download the VI Read Strings From Spreadsheet File from my website:
    http://www.jyestudio.com/lview.shtml
    It is the suggested modification of the VI Read From Spreadsheet File that comes with LabVIEW, as stated in the diagram.
    If the text file is not in spreadsheet format, then you need to write your own code to make the string table suitable for the table.
    Regards;
    Enrique
    www.vartortech.com

  • Loading data from two flat files into one table

    Hi All,
    I want to load few fields from one file and few fields from another file and load the data into one table in the database.
    For Ex: I have two flat files file1.csv and file2.csv and file1.csv containes 25 columns and file2.csv containes 12 columns, i want to load 20 columns from file1.csv and 7 columns from file2.csv into the table
    how to combine the columns from both the files and load them into one table at a time?
    Any help is appriciated
    Thanks
    R.G

    Use external tables.
    If using Oracle9 or higher connect both your csv with database as separate external tables and load the requited fields in new/requited table.

Maybe you are looking for