File to table

I run a Web-based application and using a PLSql procedure in a package I want to get the contents of a flat file that is in a directory on the server into a table in the database. What functions/procedures can I use to achieve this?

You can use UTL_FILE
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/u_file.htm#ARPLS70896
But before you do so, assuming that the file is located on trhe same server as the Oracle Server, you'll have to create a DIRECTORY object;
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/statements_5007.htm#SQLRF01207
You'll need the appropriate priviliges for both.
This is a basic demo for setting up a directory:
http://www.morganslibrary.org/reference/directories.html

Similar Messages

  • How  to load the data from excel  file  into table in oracle using UTL_FI

    How to load the data from excel file into table in oracle
    and from table to excel file
    using UTL_FILE package
    Please give me some example

    This is something i tried in oracle apex
    http://avdeo.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
    Regards,
    CKLP

  • Getting error while loading flat file into table.

    I am using ODI 11 and i am trying to load data in oracle database table using source as flat .txt file .
    When i execute the interface , i am getting below errors.
    ODI-1217: Session INF_FILE2TAB (31022) fails with return code 7000.
    ODI-1226: Step INF_FILE2TAB fails after 1 attempt(s).
    ODI-1240: Flow INF_FILE2TAB fails while performing a Loading operation. This flow loads target table PARTNER.
    Caused By: org.apache.bsf.BSFException: exception from Jython:
    Traceback (most recent call last):
    File "<string>", line 44, in <module>
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
         at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:889)
         at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
         at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
         at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:540)
         at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:202)
         at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1074)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1466)
         at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:2224)
         at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:2168)
         at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:333)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
    java.sql.SQLException: java.sql.SQLException: ORA-06564: object DAT_DIR does not exist
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:346)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2458)
         at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:48)
         at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:540)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
         at java.lang.Thread.run(Thread.java:662)
    Please let me know pointers on this.

    Yes,after your sugestion i have created ODI agent and tested the file system connection in topology. It was connected successfully.
    but when i tried again for file to table load. Again got below error.
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (most recent call last):
    File "<string>", line 44, in <module>
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
         at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:889)
         at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
         at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
         at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:540)
         at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:202)
         at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1074)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1466)
         at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:2224)
         at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:2168)
         at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:333)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
    java.sql.SQLException: java.sql.SQLException: ORA-06564: object DAT_DIR does not exist
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:346)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2458)
         at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:48)
         at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:540)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
         at java.lang.Thread.run(Thread.java:662)
    Please suggest.

  • How to import a table which is in mdb file(same table in different mdb's)

    Hello,
    how to import a table which is in mdb file(same table in different mdb's)
    e.g. table 'EMPLOYEE' is in 'test.mdb' the same table 'EMPLOYEE' is in 'current.mdb'
    How this can be done on click of a button on my form if the path of mdb is provided?
    Thanks

    This question is not related with ora dev forms, its about Microsoft Access.
    Use import option (File >> Get External Data >> Import)
    or use TransferDatabase action.

  • ODI11g -  problem using Date transformation in a file to table ineterface

    I have a file to table interface which has few optional date fields on source data store.My requirement is to pass NULL if the date field is empty in the csv file (source).
    I achieved it in 10g ODI by using
    decode(col_name,'',NULL,to_date(col1,''mm/dd/yy");
    This works perfect in 10g.
    When I migrate the same to 11g, this is not working as the c$ table is getting created with 2 columns for each column where i use decode.
    For ex: If i have a,b,c colmns and if iam using decode on b, the c$ is
    c1_a
    c2_b
    c3_b
    c4_c
    Hence the interface fails inserting data into c$.
    Iam transfering file to netezza db.
    using oracle to netezza LKM
    netezza control append IKM
    Please lemme know the way of handling empty fileds in the file to pass the same as NULL.
    Any help on this is much appreciated.
    Thanks,
    Naveen Kumar T.

    Here:
    set the_day to day of (current date)
    set the_month to month of (current date) as number
    set the_string to "Users:Boomdoggin:Important Files:Misc. Files:Plans:To Do Lists:Daily To Do Lists:" & the_month & "." & the_day & ".pages"
    tell application "Pages"
    activate
    open the_string
    end tell
    (52831)

  • How can i load Client side XML file to Table

    Hi,
    How can i load the all the XML files (near 10,000 files) available in client machine to the XML table .
    I did try with directrory list in the Webutility demo form, but when the number of file is near to 1,500 its giving error.
    Please suggest the best method to implement my requirements.
    1. XML fies are in a folder in end users machine(Windows OS)
    2. I need to load all the XML files to table (Oracle Database is in Unix)
    I am using forms 10g
    Thanks in advance.
    Rizly

    Hi,
    What is the error you are getting when you reach 1,500 records? Can you post it? You mentioned you are using the webutil to load them. How you are loading? From the client machine you are loading to the database directly? Can you post the code you are using for that?
    -Arun

  • Documents in the file sharing table in iTunes

    I have documents in the File Sharing table (in the apps button) which are coming up when the iPages app is selected. A lot of them I do not wish to sync with my iPad and therefore, I would like to delete them. However, I am not able to. Any ideas?

    Click on the file and press the Delete key on your keyboard.

  • Conversion of Flat file to tables in oracle

    hi
    i am doing my project in oracle and i have got stuck up at a point where i have to convert flat files to tables in oracle
    Please suggest a solution for the above problem
    Regards,
    Mahesh

    Hi,
    Sql*Loader, to load data from file to an oracle internal table
    or
    External table (from 9i and later), to query directly the file like an other internal table
    Nicolas.

  • Help on File - itab - table problem

    Good day!
    My problem is this. I am suppose to create an ABAP program that would get the 2 inputs from the user. The table name as well as a filename. My program should be able to transfer the contents from the file to the table in their respective fields. Now, the file is tab-delimited. and I should transfer the contents to the respective tables. The file is I am testing right now has about a 1000 entries so for every 1 row in the file, it is equivalent to the fields in the table. ex.
    CoCd     DocumentNo     S     PLSTAT     Period     Reference     ZZGRP     BIZ_TYPE     Doc. Type     Crcy     Document Header Text     Pstng Date     Cre.Date     Last updte
    2200     924     1          06     4000013407               ME     AED     INV.7800009952-BL30240499     06/02/2008     06/05/2008     06/05/2008
    That's just one entry. It looks messy because it is crammed into this box. but in a text file it is actually per line. My code now looks like this.
    REPORT  ZISZT_UPL_PDPL                          .
    *DATA DECLARATIONS                                                     *
    TABLES: ZISZT_ZPDPLH, ZISZT_ZPDPLD.
    PARAMETERS: tble_n(20) TYPE C OBLIGATORY,
                file_n(20) TYPE C OBLIGATORY.
    DATA: BEGIN OF zpdplh_tab OCCURS 100.
          INCLUDE STRUCTURE ZISZT_ZPDPLH.
    DATA: END OF zpdplh_tab.
    DATA: FILE TYPE STRING.
    FILE = file_n.
    *UPLOAD FILE TO TABLE                                                  *
    CALL FUNCTION 'GUI_UPLOAD'
         EXPORTING
             FILENAME               = FILE
             FILETYPE               = 'DAT'
         TABLES
             DATA_TAB               = zpdplh_tab
         EXCEPTIONS
            FILE_OPEN_ERROR         = 1
            FILE_READ_ERROR         = 2
            OTHERS                  = 3.
    LOOP AT zpdplh_tab.
      WRITE zpdplh_tab-BUKRS.
    ENDLOOP.
    The Loop is just to test if my internal table is getting the contents of the file. But it seems that it only gets one line. How do i fix this? Also, am I doing the right thing? Creating an internal table to transfer the files to then I would transfer it to the table in the database. Is this right? Or is there an easier way, I am suppose to transfer its contents to the table inputted by the user. Is there possible to implement some error cehcking here as well? Thanks in advance for the ideas and adivces,

    hi there check this ..
    DATA: BEGIN OF zpdplh_t OCCURS 100.
    INCLUDE STRUCTURE ZISZT_ZPDPLH.
    DATA: END OF zpdplh_t.
    data: zpdplh_tab type standard table of zpdplh_t.
    and one more thing.. gui_upload will not work in background.. so check if it might be an issue later..
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    FILENAME = PATH
    FILETYPE = 'ASC'
    HAS_FIELD_SEPARATOR = 'X'
    HEADER_LENGTH = 0
    TABLES
    DATA_TAB = ITAB
    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.

  • Attach a autocad DWG files to Table in database

    Hi 
    How could i attach Auto Cad Drawing files to a Table?
    Thank you

    Hello,
    What do you mean with "attach file to table", that' not a clear question for me? Do you mean to import the file into a table in a BLOB column? Or do you mean the usage of a FileTable table? Or ...?
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Text File to Table

    Hi,
    I need to Convert a text file in a specific format to table.
    Please find the attachment for the text file.
    the table contains columns Section, Address, Data, Attribute.
    Anybody please share me a sample VI to implement the above.
    -mfp.
    Attachments:
    ADC1.txt ‏1 KB

    Please try to understand what smercurio told you : We can help you learn how to use LabVIEW, but we are not here to help you do your home work.
    If you want help, you should show us what you have attempted yet : attach an example of your code. This will help us understand where you are stuck. If you don't, you will send us a very strong negative message.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Processing a .CSV file to Table

    HI Friends,
    Please le tme know how to process a .CSV file to Table by using SQL loader Concept.
    No other technique required...! Know it can be done thru various processes. But needed in the above way...
    Thanks in adv...!
    tempdbs
    www.dwforum.net

    here:
    http://forums.oracle.com/forums/search.jspa?threadID=&q=loading+csv+sql+loader&objID=c84&dateRange=lastyear&userID=&numResults=15

  • Import txt files into table

    Hi all,
    I was created table A with A1 and A2 columns.
    create table A (number A1, varchar A2).
    I have file.txt from my desktop like
    1,elementA
    2,elementKK
    3,elementMM
    1000,element YIIO
    How to import this file into table A with A1 have number and A2 have elements
    from txt file using sql plus editor?
    Thanks in advance

    Hi,
    Below example using External Table Feature.
    create a directory on the server where your database is installed and copy your data file(text file) in that directory. In the below example Oracle directory name is "text_file" and the physical directory on the server is "D:\TEXT_FILE\". The file name of data file is "data.txt".
    create directory text_file as 'D:\TEXT_FILE\';
    DROP TABLE load_a;
    CREATE TABLE load_a
    (a1 varchar2(20),
    a2 varchar2(200))
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY text_file
    ACCESS PARAMETERS
    (FIELDS TERMINATED BY ','
    LOCATION ('data.txt')
    select * from load_a;
    now you can use
    insert into a select * from load_a;
    Sachin Chauhan

  • Write tif file color table

    Hello:
    I am trying to write a 16-bit tif file with the proper color table using Vision utility.  I cannot get the proper color table.  I can save as other formats but have special requests for 16-bit tif.
    I have attached an example VI to show you this including a test color table and image.  I will cross post in the Vision forum also.  Any help is appreciated.
    Sincerely,
    Don
    Attachments:
    test_write_tiff.vi ‏56 KB
    normalize_2darray_data_for_16-bit_scanner.vi ‏13 KB

    Identical post in machine vision message board: write tif file color table
    Hope this helps.
    -Ben
    WaterlooLabs

  • Loading file nto table

    hi all,
    i have a text file or a document or some other file somwhere in my hard disk and i want to insert that into my table ........... i want this to be done by hardcoding the file into table using an sql query or an insert statement .......... i alreay have a table with a column of type blob .........i have a file browse item in my form and i select the file thru this one......... i want to manually insert the file selected using aan query or insert statement or a procedure ........can anyone help me .........
    i used some FILETOBLOB function but sql was not able to identify that function ...... it was giving "invalid identifier error" ..... this was the easiest solution i found but it wasnt working
    Edited by: the_reckoner on Oct 20, 2009 1:01 AM

    Hi,
    Have you check Document library app ?
    http://www.oracle.com/technology/products/database/application_express/packaged_apps/packaged_apps.html#DOC_LIB
    And also sample application that comes with Apex may help you. Check page 6.
    Br, Jari

  • Two flat files  to table

    I have an problem with two plat file to table.
    here i am sending two flat file inthe sence just some spcified filedslike
    MY first file is Like
    Name     City     
    Jerry     Delhi     
    Second file is like
    CIty Country
    Vincent USA
    So these two are club and populate on Oracle table(Target Table)
    I taken the two datastores and put it into source when i trying to maping showing
    error like "Technology cannot be an expression."
    So please can any can give sugession for these.
    Thanks advance.

    for this problem,
    follow the steps:-
    1.)drag the two data stores(ur two files) onto source area
    2.)join the common column between them just by clicking
    and make it sure that in properties of this join execute on option is set to
    staging area
    3.)now drag the target colum to target
    4.)map the coresponding fields from two source data stores to target data store
    (again make it sure that in properties of each column of target data storeexecute on option is set to
    staging area)
    now simply excute...
    and it will work

Maybe you are looking for

  • Hi.can u pls help me out I'm stuck and don't know what to do..

    pls help me out...can i activate my iPhone 4s without knowing the previous owners iCloud password???i bought the phone and have no clue on where to find him.

  • Pricing conditions in sales order.

    Hi, In my sales order pricing conditions, the Condition values are coming in change mode. so that the users can change the condition values. I want to make it as disply mode. how can i do? Regards, jyothi.

  • Outlook 2010 won't work

    I receive the following error when trying to set up an account for outlook 2010. The connection to Microsoft Exchange is unavailable.  Outlook must be online or connected to complete this action. Chuck

  • I can't print from adobe reader

    I just installed a new wireless printer.  I can print from all programs except Adobe Reader.  I get a print dialogue box, but when I try to click Print, Properties, or Page Setup, nothing happens. I contacted Epson but they said it must be an Adobe i

  • IPhoto doesn't start

    IPhoto 5.04 doesn't start (iMovie also). Problem: right of access. Disk utility doesn't find any problem but pacifist does. Message : /Library - Modus is 1775, the package indicated 775. How can I solve this problem?