HOW TO IMPORT HUNDREDS OF TEXT FILE TO DATABASE AS TABLE

Hi,
I have hundreds of text files in my computer. Every text file includes records. I want to see these records in one table at the database. How can I do that?
thank you very much for help
ömer faruk akyüzlü
in Turkey

I have a standard template that my developers use for reading text files using External Tables . Each developer gets an external table to read in test data. The format the data in CSV format, but you could use others. The External Table points to a generic file name, such as "csv_data". They then just rename the file or create a link to it, depending on the OS.
My solution uses the Directory objects. The following can be put in a script and run passing the first argument as the developers name. It supports a csv file upto 15 columns, but you can expand it.
-- begin script
CREATE OR REPLACE DIRECTORY &1 as '/home/&1';
grant read on directory &1 to public;
alter session set current_schema=&1;
--drop table csv_data;
CREATE TABLE csv_data
col1 VARCHAR2(250),
col2 VARCHAR2(250),
col3 VARCHAR2(250),
col4 VARCHAR2(250),
col5 VARCHAR2(250),
col6 VARCHAR2(250),
col7 VARCHAR2(250),
col8 VARCHAR2(250),
col9 VARCHAR2(250),
col10 VARCHAR2(250),
col11 VARCHAR2(250),
col12 VARCHAR2(250),
col13 VARCHAR2(250),
col14 VARCHAR2(250),
col15 VARCHAR2(250)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY &1
ACCESS PARAMETERS
(RECORDS DELIMITED BY newline
NOBADFILE
NODISCARDFILE
NOLOGFILE
SKIP 0
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
RTRIM
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
col1 CHAR, col2 char,col3 char,col4 char,col5 char,col6 char,col7 char,col8 char,col9 char,
col10 char,col11 char,col12 char,col13 char,col14 char,col15 char
LOCATION (&1:'csv_data')
REJECT LIMIT Unlimited
NOPARALLEL
NOMONITORING
--end script

Similar Messages

  • How to extract data from  text file to database table

    Hi ,
    I am trying to upload  data in text file to database table  using GUI_UPLOAD function .what would be the program for that.
    thanks in advance.

    Hi,
    I don't think you have a standard sap program to upload data from file to database table...
    Instead you can create a custom program like this..
    DATA: T_FILEDATA(1000) OCCURS 0 WITH HEADER LINE.
    DATA: T_ZTABLE LIKE ZTABLE OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = 'C:\TEST.TXT'
      tables
        data_tab                      = T_FILEDATA
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT T_FILEDATA.
      T_ZTABLE = T_FILEDATA.
      APPEND T_ZTABLE.
    ENDLOOP.
    MODIFY ZTABLE FROM TABLE T_ZTABLE.
    COMMIT WORK..
    Thanks,
    Naren

  • How to store multiple format text file in a oracle table

    Hi,
    I want to store a file which has multiple format for field separation so is it possible in Oracle data integrator if yes then how .....
    Waiting for reply
    regards
    palash

    Hello,
    <p>Read this article.</p>
    Francois

  • How do I open a text file to sort using bubble sort?

    Hi,
    I have a text file, which is a list of #'s.. ex)
    0.001121
    0.313313
    0.001334
    how do you open a text file and read a list? I have the bubble sort code which sorts.. thanks

    I wrote this, but am getting a couple errors:
    import java.util.*;
    import java.io.*;
    public class sort
         public static void main(String[] args)
              String fileName = "numsRandom1024.txt";
              Scanner fromFile = null;
              int index = 0;
              double[] a = new double[1024];Don't use double. You should use something that implements Comparable, like java.lang.Double.
              try
                   fromFile = new Scanner(new File(fileName));
              catch (FileNotFoundException e)
    System.out.println("Error opening the file " +
    " + fileName);
                   System.exit(0);
              while (fromFile.hasNextLine())
                   String line = fromFile.nextLine();
                   a[index] = Double.parseDouble(line);Don't parse to a double, create a java.lang.Double instead.
                   System.out.println(a[index]);
                   index++;
              fromFile.close();
              bubbleSort( a, 0, a.length-1 );No. Don't use a.length-1: from index to a.length-1 all values will be null (if you use Double's). Call it like this:bubbleSort(a, 0, index);
    public static <T extends Comparable<? super T>> void
    d bubbleSort( T[] a, int first, int last )
              for(int counter = 0 ; counter < 1024 ; counter++)
    for(int counter2 = 1 ; counter2 < (1024-counter) ;
    ) ; counter2++)Don't let those counter loop to 1024. The max should be last .
                        if(a[counter2-1] > a[counter2])No. Use the compareTo(...) method:if(a[counter2-1].compareTo(a[counter2]) > 0) {
                             double temp = a[counter2];No, your array contains Comparable's of type T, use that type then:T temp = a[counter2];
    // ...Good luck.

  • Import data form text files

    I wish to import multiple text files into one table in SQL Server 2008 but I don't have SSIS
    capability. I wish for the format of the file to stay the same (no formatting or modification of data) and I wish for each file to be dumped into its own row under one column heading (e.g. 'Data')

    Please use BULK INSERT to bring the text files into a SQL table...but you have to know the layout of the data, and create destination table
    (whether it's a "staging" table or the real table) before you do anything else.you also need to know how the file is delimtied...comma delimited , tab delimited, or fixed width, or some custom delimiter. Sample :
    BULK INSERT MULTIPLE FILE
    -a table to loop thru filenames drop table ALLFILENAMES
    CREATE TABLE ALLFILENAMES(WHICHPATH VARCHAR(255),WHICHFILE varchar(255))
    --the source table: yours already exists, but needed for this example.
    CREATE TABLE BULKACT(RAWDATA VARCHAR (8000))
    --some variables
    declare @filename varchar(255),
    @path varchar(255),
    @sql varchar(8000),
    @cmd varchar(1000)
    --get the list of files to process:
    SET @path = 'C:\DB\'
    SET @cmd = 'dir ' + @path + '*.txt /b'
    INSERT INTO ALLFILENAMES(WHICHFILE)
    EXEC Master..xp_cmdShell @cmd
    UPDATE ALLFILENAMES SET WHICHPATH = @path where WHICHPATH is null
    SET @path = 'C:\DB2\'
    SET @cmd = 'dir ' + @path + '*.txt /b'
    INSERT INTO ALLFILENAMES(WHICHFILE)
    EXEC Master..xp_cmdShell @cmd
    UPDATE ALLFILENAMES SET WHICHPATH = @path where WHICHPATH is null
    SET @path = 'C:\DB3\'
    SET @cmd = 'dir ' + @path + '*.txt /b'
    INSERT INTO ALLFILENAMES(WHICHFILE)
    EXEC Master..xp_cmdShell @cmd
    UPDATE ALLFILENAMES SET WHICHPATH = @path where WHICHPATH is null
    SET @path = 'C:\DB4\'
    SET @cmd = 'dir ' + @path + '*.txt /b'
    INSERT INTO ALLFILENAMES(WHICHFILE)
    EXEC Master..xp_cmdShell @cmd
    UPDATE ALLFILENAMES SET WHICHPATH = @path where WHICHPATH is null
    --cursor loop
    declare c1 cursor for SELECT WHICHPATH,WHICHFILE FROM ALLFILENAMES where WHICHFILE like '%.txt%'
    open c1
    fetch next from c1 into @path,@filename
    While @@fetch_status <> -1
    begin
    --bulk insert won't take a variable name, so make a sql and execute it instead:
    set @sql = 'BULK INSERT BULKACT FROM ''' + @path + @filename + ''' '
    + ' WITH (
    DATAFILETYPE = ''char'',
    FIELDTERMINATOR = ''||||'',
    ROWTERMINATOR = ''\n'',
    FIRSTROW = 1
    print @sql
    exec (@sql)
    fetch next from c1 into @path,@filename
    end
    close c1
    deallocate c1
    Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/

  • How do I get a text file from Photoshop  to work in the main sequence in pp?

    How do I get a text file to work properly in the master sequence. I moved it from Photoshop, which I learned to do from a tutorial, but when I move the animated text sequence to the master, it either isnt running, or it is scaled way too big. How do I get it to run in the main sequence?

    "Wont Work Here" !  Does not mean much.
    Are you having an audio or a video issue? 
    Looks like no video clip on the video layer above that section of audio.
    I am teaching myself this stuff completely on the fly
    I suggest you do the Basic Tutorials ( Adobe TV for example) in both Premiere Pro and PhotoShop.
    You need to be competent in the basics and fundamentals of these apps and that will also help you describe and discuss the issues.   Check the 'Products on this site....
    Adobe TV

  • How to read a whole text file into a pl/sql variable?

    Hi, I need to read an entire text file--which actually contains an email message extracted from a content management system-- into a variable in a pl/sql package, so I can insert some information from the database and then send the email. I want to read the whole text file in one shot, not just one line at a time. Shoud I use Utl_File.Get_Raw or is there another more appropriate way to do this?

    how to read a whole text file into a pl/sql variable?
    your_clob_variable := dbms_xslprocessor.read2clob('YOUR_DIRECTORY','YOUR_FILE');
    ....

  • Is it possible to import a Fixed Text file that does not have a header?

    I'm trying to import a Fixed Text file through Import Manager, but the text file I am receiving does not have a header on it (the first row is valid data). When I try importing this, Import Manager uses the first row of data as the headings. Is there any way to turn this off and tell Import Manager there is no header data in the file?
    Thanks!

    Hi Ryan ,ur requirement can be met only when u import the file as ODBC .for this follow the below steps.
    1)Go to control panel,in ur settings,select administrative tools
    2) In that select DATA SOURCE(ODBC ).
    3)Go to SYSTEM DSN tab select tab .
    4)Select ur file type MICROSOFT TEST DRIVER (.txt,.csv)
    5)Double click on "Import DSN" and in the blank give the name of DATA SOURCE NAME any name u want to give.
    6)Uncheck the use current directory box and select the directory ur file is it will automatically show ur source file select it and click ok.
    7) Now when u import ur file as ODBC give the name of ur DATA source name which u have given and it will show ur file in the source preview itself .
    In  this way u can import ur file as ODBC.
    Hope this may help u.
    Regards
    Ankit

  • How to read the whole text file lines using FTP adapter

    Hi all,
    How to read the whole text file lines when error occured middle of the text file reading.
    after it is not reading the remaining lines . how to read the whole text file using FTP adapter
    pls can you help me

    Yes there is you need to use the uniqueMessageSeparator property. Have a look at the following link for its implementation.
    http://download-west.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/adptr_file.htm#CIACDAAC
    cheers
    James

  • How to scan/ read a text file, pick up only lines you wanted.

    I'm new to Labview, I trying to wire a VI which can read a text file
    example below:
    Example: My Text File:
    1 abcd
    2 efgh
    8 aaaa
    1 uuuu
    and pick out only any line which start with number 1 (i.e 1 abcd)
    then output these 2 lines out to a a new text file?
    Thanks,
    Palmtree

    Hi,
    How do you creat your text files? Depending on the programm, there is added characters in the beginning and at the and of the file. So here you will find a VI to creat "raw" text files.
    To debug your VIs, use the probs and breakpoints, so you can solve the problem by your self or give an more accurate description of it.
    There is also the VI that read a integer and two strings  (%d %s %s)
    Attachments:
    creat text file.vi ‏9 KB
    read_from_file.vi ‏14 KB

  • How to write data to text file using external tables

    can anybody tell how to write data to text file using external tables concept?

    Hi,
    Using external table u can load the data in your local table in database,
    then using your local db table and UTL_FILE pacakge u can wrrite data to text file
    external table
    ~~~~~~~~~~~
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2153251
    UTL_FILE
    ~~~~~~~~~
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14093
    Message was edited by:
    Nicloei W
    Message was edited by:
    Nicloei W

  • How to append paragraph in text file of TextEdit application using applescript

    how to append paragraph in text file of TextEdit application using applescript and how do i save as different location.

    christian erlinger wrote:
    When you want to print out an escape character in java (java is doing the work in client_text_io ), you'd need to escape it.
    client_text_io.put_line(out_file, replace('your_path', '\','\\'));cheersI tried replacing \ with double slash but it just printed double slash in the bat file. again the path was broken into two lines.
    file output
    chdir C:\\DOCUME~1\
    195969\\LOCALS~1\\Temp\
    Edited by: rivas on Mar 21, 2011 6:03 AM

  • How to create and read text file using LabVIEW 7.1 PDA module?

    How to create and read text file using LabVIEW 7.1 PDA module? I can not create a text file and read it.
    I attach my code here.
    Attachments:
    File_IO.vi ‏82 KB

    Well my acquisition code runs perfect. The problem is reading it. I can't seem to read my data no matter what I do. My data gets saved as a string using the array to string vi but I've read that the string to array vi (which I need to convert back to array to read my data) does not work on the pda. I'm using version 8.0. So I was trying to modify the program posted in this discussion so that it would save data from my DAQ. I did that but I still can't read the data after its saved. I really don't know what else to do. All I need to do is read the data on the pda itself. I can't understand why I'm having such a hard time doing that. I found a possible solution on another discussion that talks about parsing the strings because of the bug in the "string to array" vi. However, that lead me to another problem because for some reason, the array indicators or graphs don't function on the pda. When i build the program to the pda or emulator, the array indicators are faded out on the front panel as if the function is not valid. Does this kind of help give a better picture of what I'm trying to do. Simply read data back. Thanks.

  • How to import Word or Excel files in Project 2013.

    I am facing a problem in Microsoft Project 2013. I am trying to insert a word or an excel file into Project 2013. But for each file,
    an import wizard appears and after trying all the possibilities, I am unable to finish it. Please help me out and tell me how to import Word or Excel file in Project 2013.

    Parulg --
    From your description, it sounds like you are trying to attach a Word or Excel document to a project, or to insert the Word or Excel document into the project.  If that is the case, you actually need to attach the Word or Excel document to a task in
    the project.  There are several ways to do this, but in either case you first need to open the project to which you want to attach the Word or Excel document.  You can then use one of several methods, which are:
    Click the View tab to display the View ribbon.  In the Data section of the View ribbon, click the Tables pick list button and select the More Tables option.  In the More Tables dialog, select the Hyperlink table and then click the Apply button.
     For any task in the project, enter the hyperlink to the Word or Excel document in the Hyperlink column for that task.
    Double-click a task and then click the Notes tab.  On the Notes page of the Task Information dialog, click the Insert Object button.  In the Insert Object dialog, select the Create from File option and then use the Browse button to navigate to
    the folder containing the Word or Excel document.  In the Browse dialog, select the Word or Excel document and click the Insert button. In the Insert Object dialog, select the Display As Icon checkbox.  You can also select the Link checkbox if you
    want to create a shortcut to the document rather than embedding the document in your Project file.  Click the OK button when finished.
    Just a couple of ideas based on my assumption about what you are trying to do.  Please let us know if my assumption is wrong.  Hope this helps.
    Dale A. Howard [MVP]

  • How to import microsoft outlook pst files from window 7 to mac mail

    How to import microsoft outlook pst files from window 7 to mac mail??

    Outlook PST to MBOX Converter is a best and user-friendly software that facilitates smooth conversion of Outlook mailboxes (PST files) to MBOX files. The software supports PST to MBOX migration for Thunderbird, Spicebird, SeaMonkey, and Netscape.
    For more information and free download click http://psttombox.blogspot.com

Maybe you are looking for