Need info on using external tables load/write data

Hi All,
We are planning to load conversion/interface data using external tables feature available in the Oracle database.
Also for outbound interfaces, we are planning to use the same feature to write data in the file system.
If you have done similar exercise in any of your projects, please share sample code units. Also, let me know if there
are any cons/limitations in this approach.
Thanks,
Balaji

Please see old threads for similar discussion -- http://forums.oracle.com/forums/search.jspa?threadID=&q=external+AND+tables&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
Thanks,
Hussein

Similar Messages

  • Report question: how to use external table to bring data from excel file?

    i need to import excel data into oracle report, how to do that? thanks.

    Hi... What is the error message you get when using external tables?
    You must create a control center connection in the Connection Explorer.
    I recommend you read this:
    http://download-east.oracle.com/docs/cd/B31080_01/doc/owb.102/b28223/toc.htm
    Look for the following sections:
    - Using External Tables (and the "External Tables versus Flat File Operators" sub section)
    - About Flat File Modules
    - Chapter 16, Deploying Target Systems
    Regards,
    Marcos

  • How to import tab delimited using external table?

    Hi all,
    I'm using external table to import data from a tab delimited file. However, I keep getting an error message. I used both TERMINATED BY OX'09' and X'09' but still could not get it work.
    Does anyone know how to solve this problem?
    Thank you very much.

    Hi
    Try this:
    import datafile="/myfiles/mydata" out=mydata dbms=tab replace delimiter='&' getnames=yes
    run;
    Thanks

  • How to load external data without using external tables

    Hi,
    I'm asked to develop an ETL for loading external data into a database but, unfortunately, the vers. is 8i so I can't use external tables.
    I know that it's possible by using SQL-Loader. What I want to know is whether there's another way in 8i to load external data from a text file or a CSV file directly with a stored procedure without having to write CTL of SQL-Loader on the server. I mean, is there a way to write everything on the database the same manner I'd do whether I wrote data from a table to a file using for example UTL_FILE or the unique way is to write control files of SQL-Loader directly on the server?
    Thanks!

    Mark1970 wrote:
    Thank you very much Karthick
    I didn't know I could use UTL_FILE also for reading files. I've always use it only for writing data into external files.Yes you can use UTL_FILE to read. The version of oracle you are using i last used in 2004 :) Still remember giving the OS path of the file to open the file. That is long gone now. Its surprising that you are still in 8i.

  • Need to merge a csv file using external tables into a main table

    Hi,
    I have a csv file which contains the date(with time stamp), column1(number),column2(number), column3 (number). I am using external tables concept to load the data froom csv to this external table and then merging into the main table. Problem here is : the csv file is a system generated file and nothing can be edited under it. our aim is to automate this process of loading data from csv to the table. In this csv the date time stamp is not in the proper format.I mean the date is not visible and only minutes and seconds are visible.By changing the format in csv manually this can be overcome.but we donot need any manual intervention.
    how can i overcome this problem ?? please help mee...
    Excels data looks like:
    (PDH-TSV 4.0) (India Standard Time)(-330)     \\DISAPPSER01\Processor(_Total)\% Privileged Time     \\DISAPPSER01\Processor(_Total)\% Processor Time     \\DISAPPSER01\Web Service(_Total)\Current Connections
    56:59.0               47
    57:09.0     0.72379582     4.204561281     46
    57:19.0     0.916548537     4.006179927     44
    57:29.0     0.663034771     3.674662541     43
    57:39.0     0.750789844     4.093933999     42
    57:49.0     0.721538487     2.650858026     40
    57:59.0     0.594781604     3.333393703     40

    please format your sample data giving header to the column so that we can make sense out of the values, also since the minutes and seconds are only given, what is the date to be considered for records to be moved to the master table, sysdate or will the date be passed as a parameter?

  • 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

  • Need help in Creating External Tables

    Hi All,
    I have a flat file containing numberic data, CLOB data, and also date columns data. I have to load this flat file data into staging server table using External tables. I have to write a stored procedure in such way creating exteranl tables dynamically. My question or need help from you people is that how to define the external table to load the CLOB data from flat file.
    Thanks,
    Sankar

    The LOCATION clause of an external table specifies the file or files to be read when the table is queried. You can change it to refer to different files without dropping and recreating the table and invalidating all dependent code.
    Regarding DBMS_SQL, yes you can do it the hard way if you prefer.
    Good point about CLOB columns in external tables. Quite possibly they are not supported, but I would have to check the manuals and try some examples.

  • Error while fetching data from OWB Client using External Table.

    Dear All,
    I am using Oracle Warehouse Builder 11g & Oracle 10gR2 as repository database on Windows 2000 Server.
    I facing some issue in fetching data from a Flat File using external table from OWB Client.
    I have perform all the steps without any error but when I try to view the data, I got the following error.
    ======================================
    RA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file expense_categories.csv in SOURCE_LOCATION not found
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
    java.sql.SQLException: ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file expense_categories.csv in SOURCE_LOCATION not found
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
         at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
         at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
         at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:183)
         at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:774)
         at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:849)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
         at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1377)
         at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:386)
         at oracle.wh.ui.owbcommon.QueryResult.<init>(QueryResult.java:18)
         at oracle.wh.ui.owbcommon.dataviewer.relational.OracleQueryResult.<init>(OracleDVTableModel.java:48)
         at oracle.wh.ui.owbcommon.dataviewer.relational.OracleDVTableModel.doFetch(OracleDVTableModel.java:20)
         at oracle.wh.ui.owbcommon.dataviewer.RDVTableModel.fetch(RDVTableModel.java:46)
         at oracle.wh.ui.owbcommon.dataviewer.BaseDataViewerPanel$1.actionPerformed(BaseDataViewerPanel.java:218)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:282)
         at oracle.wh.ui.owbcommon.dataviewer.BaseDataViewerPanel.executeQuery(BaseDataViewerPanel.java:493)
         at oracle.wh.ui.owbcommon.dataviewer.BaseDataViewerEditor.init(BaseDataViewerEditor.java:116)
         at oracle.wh.ui.owbcommon.dataviewer.BaseDataViewerEditor.<init>(BaseDataViewerEditor.java:58)
         at oracle.wh.ui.owbcommon.dataviewer.relational.DataViewerEditor.<init>(DataViewerEditor.java:16)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at oracle.wh.ui.owbcommon.IdeUtils._tryLaunchEditorByClass(IdeUtils.java:1412)
         at oracle.wh.ui.owbcommon.IdeUtils._doLaunchEditor(IdeUtils.java:1349)
         at oracle.wh.ui.owbcommon.IdeUtils._doLaunchEditor(IdeUtils.java:1367)
         at oracle.wh.ui.owbcommon.IdeUtils.showDataViewer(IdeUtils.java:869)
         at oracle.wh.ui.owbcommon.IdeUtils.showDataViewer(IdeUtils.java:856)
         at oracle.wh.ui.console.commands.DataViewerCmd.performAction(DataViewerCmd.java:19)
         at oracle.wh.ui.console.commands.TreeMenuHandler$1.run(TreeMenuHandler.java:188)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    ===========================
    In the error it is showing that file expense_categories.csv in SOURCE_LOCATION not found but I am 100% sure that file is very much there.
    Is anybody face the same issue?
    Do we need to configure something before loading data from a flat file from OWB Client?
    Any help would higly appreciable.
    Regards,
    Manmohan Sharma

    Hi Detlef / Gowtham,
    Now I am able to fetch data from flat files from OWB Server as well as OWB Client.
    One way I have achieved as suggested by you
    1) Creating location on the OWB Client
    2) Samples the files at client
    3) Created & Configured external table
    4) Copy all flat files on OWB Server
    5) Updated the location which I created at the client.
    Other way
    1) Creating location on the OWB Client
    2) Samples the files at client
    3) Created & Configured external table
    4) Copied flat files on the sever in same drive & directory . like if my all flat files are on C:\data at OWB Client then I copied flat file C:\data on the OWB Server. But this is feasible for Non-Windows.
    Hence my problem solved.
    Thanks a lot.
    Regards,
    Manmohan

  • How to find rejected rows using External Table

    Hi all,
    I had written a stored procedure to read comma(,) separated flat file using External Tables in oracle 9i with Reject Limit "Unlimited" Option. Sometimes all rows are successfully loaded into external table and sometimes some rows are failed, I can find out those rows from logfile created by oracle. I want to inserted those rows key values into some other table. Can any body suggest/links how to write this.
    Thanking you in advance

    "Is there a way to have the system truncate the log files besides some O/S utility that will scour the directory every night, week, etc.?"
    You can use UTL_FILE.FREMOVE to delete the file, if you have sufficient privileges. You can schedule it using DBMS_JOB if you like or run it before you recreate the file, as demonstrated below. The pl/sql block to check whether the file exists is used for demonstration purposes only and is not necessary. This is just one method. There are various ways to delete or truncate a file. This just seems like the simplest.
    scott@ORA92> CREATE OR REPLACE DIRECTORY mydir AS 'c:\oracle'
      2  /
    Directory created.
    scott@ORA92> DECLARE
      2    v_bfile BFILE := BFILENAME ('MY_DIR', 'test_tab.log');
      3  BEGIN
      4    IF DBMS_LOB.FILEEXISTS (v_bfile) = 1
      5    THEN DBMS_OUTPUT.PUT_LINE ('test_tab.log exists');
      6    ELSE DBMS_OUTPUT.PUT_line ('test_tab.log does not exist');
      7    END IF;
      8  END;
      9  /
    test_tab.log exists
    PL/SQL procedure successfully completed.
    scott@ORA92> EXECUTE UTL_FILE.FREMOVE ('MY_DIR', 'test_tab.log')
    PL/SQL procedure successfully completed.
    scott@ORA92> DECLARE
      2    v_bfile BFILE := BFILENAME ('MY_DIR', 'test_tab.log');
      3  BEGIN
      4    IF DBMS_LOB.FILEEXISTS (v_bfile) = 1
      5    THEN DBMS_OUTPUT.PUT_LINE ('test_tab.log exists');
      6    ELSE DBMS_OUTPUT.PUT_line ('test_tab.log does not exist');
      7    END IF;
      8  END;
      9  /
    test_tab.log does not exist
    PL/SQL procedure successfully completed.
    scott@ORA92> CREATE TABLE test_tab
      2    (col1 NUMBER,
      3       col2 VARCHAR2(4))
      4  ORGANIZATION external
      5    (TYPE ORACLE_LOADER
      6       DEFAULT DIRECTORY mydir
      7       ACCESS PARAMETERS
      8         (RECORDS DELIMITED BY NEWLINE
      9          BADFILE 'MYDIR':'test_bad.bad'
    10          LOGFILE 'MYDIR':'test_tab.log'
    11          FIELDS TERMINATED BY ","
    12            (col1,
    13             col2))
    14       LOCATION ('test.dat'))
    15  REJECT LIMIT UNLIMITED
    16  /
    Table created.
    scott@ORA92> SELECT * FROM test_tab
      2  /
          COL1 COL2
             1 a
             2 b
    scott@ORA92> "Or is there a way to prevent the log from being written to every time it's accessed?"
    You can use NOLOGFILE as an access parameter to prevent it from being written to, as shown below.
    scott@ORA92> CREATE OR REPLACE DIRECTORY mydir AS 'c:\oracle'
      2  /
    Directory created.
    scott@ORA92> CREATE TABLE test_tab
      2    (col1 NUMBER,
      3       col2 VARCHAR2(4))
      4  ORGANIZATION external
      5    (TYPE ORACLE_LOADER
      6       DEFAULT DIRECTORY mydir
      7       ACCESS PARAMETERS
      8         (RECORDS DELIMITED BY NEWLINE
      9          BADFILE 'MYDIR':'test_bad.bad'
    10          NOLOGFILE
    11          FIELDS TERMINATED BY ","
    12            (col1,
    13             col2))
    14       LOCATION ('test.dat'))
    15  REJECT LIMIT UNLIMITED
    16  /
    Table created.
    scott@ORA92> SELECT * FROM test_tab
      2  /
          COL1 COL2
             1 a
             2 b
    scott@ORA92> "Is there a way to have the log written only when an error occurs?"
    Not that I know of, but that does not mean that somebody else doesn't know how or isn't able to figure out a way. If you do find a way, please post it for the benefit of the rest of us.

  • Error while using External Table

    Hi Guru's,
    I am using external tables in my procedure and the code to create it will be dynamically built inside the procedure itself. I have tested it so many times and it works fine only. But suddenly now it is throwing some error and i was not able to figure out the problem.
    Additional Info:
    1. I have provided the full rights to the input directory.
    2. Working in Oracle 10g release 2
    3. Unix OS in server
    4. Error description:
    << UK_TRADINGDATA_LOAD >> ABEND : <<ABEND SYS-000 >> uncatched ORACLE-error : ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file EXTRACTION COMPLETED in EXT_UK_TRADINGDATA not found
               v_ac_sql:='CREATE TABLE VLDPROCESS'||gv_ac_schema_suffix||'.EXT_UK_TRAD_'||gv_ac_machineid ||'_'||gv_ac_retailer_id||'_ADHOC'||CHR(10)
                            ||'(  AC_RETAILER_ID       VARCHAR2(2 BYTE),'||CHR(10)
                            ||'AC_DEPARTMENT_CD     VARCHAR2(20 BYTE),'||CHR(10)
                            ||'NC_PERIOD_FROM       NUMBER,'||CHR(10)
                            ||'NC_PERIOD_TO       NUMBER'||CHR(10)   
                            ||')'||CHR(10)
                            ||'ORGANIZATION EXTERNAL'||CHR(10)
                            ||'(TYPE ORACLE_LOADER'||CHR(10)
                            ||'DEFAULT DIRECTORY EXT_UK_TRADINGDATA'||CHR(10)
                            ||'ACCESS PARAMETERS'||CHR(10)
                            ||'(RECORDS DELIMITED BY NEWLINE'||CHR(10)
                            ||'badfile     '''||v_ac_failed_files||'.bad'''||CHR(10)
                            ||'discardfile '''||v_ac_failed_files||'.dis'''||CHR(10)
                            ||'logfile     '''||v_ac_failed_files||'.log'''||CHR(10)
                            ||'FIELDS'||CHR(10)
                            ||'('||CHR(10)
                            ||'AC_RETAILER_ID   position( 1: 2) char( 2),'||CHR(10)
                            ||'AC_DEPARTMENT_CD position( 3:22) char(20),'||CHR(10)
                            ||'NC_PERIOD_FROM   position(23:29) char( 7),'||CHR(10)
                            ||'NC_PERIOD_TO     position(30:36) char( 7)'||CHR(10)     
                            ||')'||CHR(10)
                            ||')'||CHR(10)
                            ||'LOCATION ('''||v_ac_file_name ||''')'||CHR(10)
                            ||')'||CHR(10)
                            ||'REJECT LIMIT 100'||CHR(10)
                            ||'NOPARALLEL'||CHR(10)
                            ||'NOMONITORING';  
               EXECUTE IMMEDIATE v_ac_sql; Kindly help me!
    With Regards,
    VJ

    Sometimes when troubleshooting issues like this it is helpful to output the dynamic SQL generated to the screen or spool it to a text file. From there it's usually easy to determine where the problem lies.
    If you can provide that one of the forum members can figure it out.

  • How to implement row level security using external tables

    Hi All Gurus/ Masters,
    I want to implement row level security using external tables, as I'm not sure how to implement that. and I'm aware of using it by RPD level authentication.
    I can use a filter condition in my user level so that he can access his data only.
    But when i have 4 tables in external tables
    users
    groups
    usergroups
    webgrups
    Then in which table I need to give the filter conditions..
    Pl let me know this ...

    You pull the Group into a repository variable using a session variable init block, then reference that variable in the data filters either in the LTS directly or in the security management as Filters. You reference it with the syntax VALUEOF("NQ_SESSION.Variable Name")
    Hope this helps

  • SQL LOADER , EXTERNAL  TABLE and ODBS DATA SOURCE

    hello
    Can any body help loading data from dbase file .dbt to an oracle 10g table.
    I tried last day with SQL LOADER, EXTERNAL table , and ODBC data source.
    Why all of these utilities still failing to solve my problem ?
    Is there an efficient way to reach this goal ?
    Thanks in advance

    export the dbase data file to text file,
    then you have choice of using either sql loader or external table option to use.
    regards

  • How to use external table - creating NFS mount -the details involved

    Hi,
    We are using Oracle 10.2.0.3 on Solaris 10. I want to use external tables to load huge csv data into the database. This concept was tested and also found to be working fine. But my doubt that : since ours is a J2EE application, the csv files have to come from the front end- from the app server. So in this case how to move them to the db server?
    For my testing I just used putty to transfer the file to db server, than ran the dos2unix command to strip off the control character at the end of file. but since this is to be done from the app server, putty can not be used. In this case how can this be done? Are there any risks or security issues involved in this process?
    Regards

    orausern wrote:
    For my testing I just used putty to transfer the file to db server, than ran the dos2unix command to strip off the control character at the end of file. but since this is to be done from the app server, putty can not be used. In this case how can this be done? Are there any risks or security issues involved in this process? Not sure why "putty" cannot be used. This s/w uses the standard telnet and ssh protocols. Why would it not work?
    As for getting the files from the app server to the db server. There are a number of options.
    You can look at it from an o/s replication level. The command rdist is common on most (if not all) Unix/Linux flavours and used for remote distribution and sync'ing of files and directories. It also supports scp as the underlying protocol (instead of the older rcp protocol).
    You can use file sharing - the typical Unix approach would be to use NFS. Samba is also an option if NTLM (Windows) is already used in the organisation and you want to hook this into your existing security infrastructure (e.g. using Microsoft's Active Directory).
    You can use a cluster file system - a file system that resides on shared storage and can be used by by both app and db servers as a mounted/cooked file system. Cluster file systems like ACFS, OCFS2 and GFS exist for Linux.
    You can go for a pull method - where the db server on client instruction (that provides the file details), connects to the app server (using scp/sftp/ftp), copy that file from the app server, and then proceed to load it. You can even add a compression feature to this - so that the db server copies a zipped file from the app server and then unzip it for loading.
    Security issues. Well, if the internals is not exposed then security will not be a problem. For example, defining a trusted connection between app server ad db server - so the client instruction does not have to contain any authentication data. Letting the client instruction only specify the filename and have the internal code use a standard and fixed directory structure. That way the client cannot instruct something like +/etc/shadow+ be copied from the app server and loaded into the db sever as a data file. Etc.

  • How can I use external tables with directories not on Oracle host?

    Oracle 11.2.0.2
    We have developers using C# to populate global temporary tables (two one header and detail with 1 to many relationbship between these two tables). The process of using C# was blowing up memory on Windows.
    As an alternative I requested them to create two CSV files and I can use sqlldr to load the detail CSV file of over 1 million rows under 15 seconds. It came to my mind that I could use external tables for this purpose with getting read of header and trailer from the CSV files.
    The issue I have is that I am not a DBA so I do not have access to OS host that Oracle instance is running. sqlldr is a client side tool, whereas external tables are server side. I was wondering if there is an alternative in 11g to use external tables without creating directories on the OS host that Oracle runs on? Are there other alternatives?
    Thanks

    905989 wrote:
    Oracle 11.2.0.2
    We have developers using C# to populate global temporary tables (two one header and detail with 1 to many relationbship between these two tables). The process of using C# was blowing up memory on Windows.
    As an alternative I requested them to create two CSV files and I can use sqlldr to load the detail CSV file of over 1 million rows under 15 seconds. It came to my mind that I could use external tables for this purpose with getting read of header and trailer from the CSV files.
    The issue I have is that I am not a DBA so I do not have access to OS host that Oracle instance is running. sqlldr is a client side tool, whereas external tables are server side. I was wondering if there is an alternative in 11g to use external tables without creating directories on the OS host that Oracle runs on? Are there other alternatives?
    Thanks
    no other alternative

  • Why do we really use External tables in Oracle?

    I looking why do we exactly use external tables in oracle and if you can help me please give me a scenario also.

    Before External tables (long ago in a galaxy far, far away) we would have had to load the text file into the database, most likely using SQL Loader before we could 'read it'.
    External tables allow us to define the text file in the Create table syntax and read that file over and over via SQL from the databse - In summary, I can access that text file (in parallel = fast) without loading it into my database, I just saved a step in my integration. I can also swap the file for a new file (same definition) and auto-magically access by new content.
    Here is a good link with a scenario for you :
    External Tables: An Introduction – All Things Oracle
    Of course with ODI - the complexity of SQL Loader control files is hidden, we just define the text file, use the LKM File to SQL and load it in, but where is the fun in that?
    Best check with your Solution Architect about what the best practises are for this in your organization.
    Rgrds
    Alastair

Maybe you are looking for