Problem while selecting data from external tables

Hi All,
I am facing a problem with external tabels. I have created an external table
create table ext_org_table
( id varchar2(10)
, name varchar2(100)
,id_parent varchar2(10)
,name_parent varchar2(100))
organization external
( type oracle_loader
default directory MYDIR
access parameters
records delimited by newline
     nologfile
     nobadfile
fields terminated by ','
missing field values are null
location ('Orgdata.csv')
reject limit unlimited;
The problem is that when i give select * from ext_org_table , i get following error
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file Orgdata.csv in MYDIR not found
ORA-06512: at "SYS.ORACLE_LOADER", line 19
ORA-06512: at line 1
Now , i have file Orgdata.csv in the specified directory.
I have created directory in oracle using create directory command.
I have granted read,write permission on the directory to user.
I have given all read,write and execute permissions to folder where my files resides.My file resides in /appl/home/kk
Now i don't understand why it is giving error file in Mydir not found.
Kindly suggest.
Regards
Krish

Hi,
You are obviously doing someting wrong.
May be the direcotry is not present or may be the file is not rpesent in the directory.
I just tried ths
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as SYS
create directory mydir as 'c:\csv';
grant read,write on directory mydir to scott;From Scott
create table ext_org_table
( id varchar2(10)
, name varchar2(100)
,id_parent varchar2(10)
,name_parent varchar2(100))
organization external
( type oracle_loader
default directory MYDIR
access parameters
records delimited by newline
nologfile
nobadfile
fields terminated by ','
missing field values are null
location ('Orgdata.csv')
reject limit unlimited;
select * from ext_org_table;Ofcourse i made up some dummy data to test and its all OK.
again,
You may want to check if
1) If the directory exists (select * from all_directories where directory_name='MYDIR');
2) If the user has the read/write permissions on that directory
3) If the file orgdata exists in that directory.
Regards,
Bhushan

Similar Messages

  • Error while selecting date from external table

    Hello all,
    I am getting the follwing error while selecting data from external table. Any idea why?
    SQL> CREATE TABLE SE2_EXT (SE_REF_NO VARCHAR2(255),
      2        SE_CUST_ID NUMBER(38),
      3        SE_TRAN_AMT_LCY FLOAT(126),
      4        SE_REVERSAL_MARKER VARCHAR2(255))
      5  ORGANIZATION EXTERNAL (
      6    TYPE ORACLE_LOADER
      7    DEFAULT DIRECTORY ext_tables
      8    ACCESS PARAMETERS (
      9      RECORDS DELIMITED BY NEWLINE
    10      FIELDS TERMINATED BY ','
    11      MISSING FIELD VALUES ARE NULL
    12      (
    13        country_code      CHAR(5),
    14        country_name      CHAR(50),
    15        country_language  CHAR(50)
    16      )
    17    )
    18    LOCATION ('SE2.csv')
    19  )
    20  PARALLEL 5
    21  REJECT LIMIT UNLIMITED;
    Table created.
    SQL> select * from se2_ext;
    SQL> select count(*) from se2_ext;
    select count(*) from se2_ext
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04043: table column not found in external source: SE_REF_NO
    ORA-06512: at "SYS.ORACLE_LOADER", line 19

    It would appear that you external table definition and the external data file data do not match up. Post a few input records so someone can duplicate the problem and determine the fix.
    HTH -- Mark D Powell --

  • Selecting data from external table

    Hi there
    I was wondering if somebody could assist me. When I try to select data from an external table, no data is displayed, and in my log file I receive the following error:
    KUP-04026: field too long for datatype. Please find attached my external table script.
    CREATE TABLE DEMO_FILE_EXT
    MACODE               NUMBER(7),
    MANO                    NUMBER(7),
    DEPNO                    VARCHAR2(2 BYTE),
    DEPTYPE                    NUMBER(5),
    STARTDATE               NUMBER(8),
    ENDDATE               NUMBER(8),
    OPTIONSTART               NUMBER(8),
    BENEFITSTART     NUMBER(8),
    STARTSUSPEND          NUMBER(8),
    ENDSUSPEND          NUMBER(8),
    INITIALS          VARCHAR2(5 BYTE),
    FIRSTNAME          VARCHAR2(20 BYTE),
    SURNAME                    VARCHAR2(25 BYTE),
    STR1                    VARCHAR2(30 BYTE),
    STR2                    VARCHAR2(30 BYTE),
    STR3                    VARCHAR2(30 BYTE),
    STR4                         VARCHAR2(30 BYTE),
    SCODE                    VARCHAR2(6 BYTE),
    POS1                    VARCHAR2(30 BYTE),
    POS2                    VARCHAR2(30 BYTE),
    POS3                    VARCHAR2(30 BYTE),
    POS4                    VARCHAR2(30 BYTE),
    PCODE                    VARCHAR2(6 BYTE),
    TELH                    VARCHAR2(10 BYTE),
    TELW                    VARCHAR2(10 BYTE),
    TELC                    VARCHAR2(10 BYTE),
    IDNUMBER          VARCHAR2(13 BYTE),
    DOB                NUMBER(8),
    GENDER               VARCHAR2(1 BYTE),
    EMPLOYER_CODE               VARCHAR2(10 BYTE),
    EMPLOYER_NAME               VARCHAR2(900 BYTE)
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY DEMO_FILES
    ACCESS PARAMETERS
    ( RECORDS DELIMITED BY newline
         BADFILE 'Tinusb.txt'
         DISCARDFILE 'Tinusd.txt'
         LOGFILE 'Tinusl.txt'
    SKIP 1
    FIELDS TERMINATED BY '|'
              MISSING FIELD VALUES ARE NULL
         (MACODE,
         MANO,
         DEPNO,
         DEPTYPE,
         STARTDATE,
         ENDDATE,
         OPTIONSTART,
         BENEFITSTART,
         STARTSUSPEND,
         ENDSUSPEND,
         INITIALS,
         FIRSTNAME,
         SURNAME,
         STR1,
         STR2,
         STR3,
         STR4,
         SCODE,
         POS1,
         POS2,
         POS3,
         POS4,
         PCODE,
         TELH,
         TELW,
         TELC,
         IDNUMBER,
         DOB,
         GENDER,
         EMPLOYER_CODE,
         EMPLOYER_NAME
    LOCATION (DEMO_FILES:'Test1.txt')
    REJECT LIMIT UNLIMITED
    LOGGING
    NOCACHE
    NOPARALLEL;
    I have the correct privileges on the directory, but the error seems to be on the EMPLOYER_NAME field. The file I try to upload is in pipe-delimited format. The last field in the file does not have a pipe-delimiter at the end. Can this be the problem? Must I go and look for any trailing spaces? Can I specify in the external table script how many characters I need for the employer_name field? We receive this file from an external company
    Thank you very much for the help
    Ferdie

    common mistake, you gave the field sizes in the
    column listing of the table, but not in the file
    definition. oracle does not apply one to the other.
    in the file defintion section, give explict field
    sizes.Hi shoblock
    Sorry for only coming back to you now, thank you for your help, I had to give the explicit field size for the last column (employer name).
    Thank you once again!!
    Ferdie

  • How to insert decimal point while selecting data from a table

    Hi All ,
    My select requirement says , If the value received with no decimal then insert decimal before last 2 bytes. I need to retrieve data with this condition.
    May you people help how i can achieve this?
    Thanks in advance,
    Sachetan

    Is the data a number in string format?
    with q as (select '12345' myNum from dual
    union all select '45.78' from dual)
    select case when instr(myNum, '.') > 0 then to_number(myNum) else
           to_number(substr(myNum, 1, length(myNum) - 2) || '.' ||
                    substr(myNum, length(myNum) - 1)) end newNum from q
    NEWNUM
    123.45
    45.78If not just use
    with q as (select 12345 myNum from dual
    union all select 45.78 from dual)
    select case
    when instr(myNum,'.')>0 then myNum
    else myNum/100
    end myNum
    from q
    MYNUM
    123.45
    45.78

  • Problem while selecting BELNR from BSEG

    Hi Experts,
    I have a report performance problem while fetching BELNR from BSEG table.
    I have to print latest BELNR from BSEG where BUZID = ‘M’ but at the time of execution of report, It is taking too much time (More that hour and sometimes it gets hanged).
    I have also gone through the comments provided by experts for previous problems asked in this forum e.g. BSEG is a cluster table that is why data retrieval takes long time etc.
    Can any one has any other idea or suggestion  or any other way to solve this problem
    Regards,
    Neeraj

    Hi,
    1) Try to create an index on BUZID field
    2) Don't use SELECT/ENDSELECT statement. Instead of that extract all the concerned entries from BSEG into an internal table :
    select belnr from bseg appending table itab where buzid = 'M'.
    then do this :
    sort itab by belnr.
    describe itab lines n.
    read table itab index n.
    Please reward if helpful.
    Regards,
    Nicolas.

  • Problem while retrving data from a view

    Hi Friends
      i have a problem while retriving data from a view <b>v_t685a</b>.
    the error message is :""" "V_T685A" is not defined in the ABAP Dictionary as a table, projection view or database view."""
    i wrote : select single VTEXT1 from V_T685A into w_cst_jin1 where
                        KSCHL = 'JIN1' and
                        KAPPL = 'V'.
    how to retrive the data.
    waiting for quick response
    Regards
    Mukesh

    Hi
    This is a Maintenance View, not a Database View
    SO can't fetch data using select statement.
    You can use the Table <b>T685</b> directly to fetch the condition Types data straight away instead of the view. write the same select for this table and use.
    Regards
    Anji
    Message was edited by:
            Anji Reddy Vangala

  • How to select data from a table by passing document number from another tab

    How to select data from a table by passing document number from another table.
    for eg:-
    I want to display name, adres, region from ADRC table
    by using field delivery document number
    Kind Regards,
    Shanbagavalli.S

    Hi Shanbagavalli,
    There are multiple solutions to this questions a few i will try to answer and then you can take the best required for your requirements.
    **Consider that you have a Internal table having document number from other table..
    SELECT NAME ADRES REGION FROM ADRC
           INTO IT_ADRC
           FOR ALL ENTRIES IN IT_DOC
           WHERE DOCUMENT_NO = IT_DOC-DOCUMENT_NO.
    **Consider that you have 1 document number then
    SELECT NAME ADRES REGION FROM ADRC
         INTO IT_ADRC
         WHERE DOCUMENT_NO = W_DOCUMENT_NO.
    Hope this solves your problem.
    Regards,
    Kunjal

  • Error while activating data from new table of DSO to active table

    HI,
    while activating data from new table of DSO to active table i am getting
    error message as "Error occurred while deciding partition number".
    Plz any idea hoe to resolve this one.
    thanks & regards
    KPS MOORTHY

    Hi
    You are trying to update/upload the Records which are already been there in the DSO Active Data Table which has the partition.
    Try to see the Record Nos already been activated and update/upload with selective, if possible.
    You can trace the changes at Change log table for the same.
    Hope it helps
    Edited by: Aduri on Jan 21, 2009 10:38 AM

  • How can we improve the performance while fetching data from RESB table.

    Hi All,
    Can any bosy suggest me the right way to improve the performance while fetching data from RESB table. Below is the select statement.
    SELECT aufnr posnr roms1 roanz
        INTO (itab-aufnr, itab-pposnr, itab-roms1, itab-roanz)
        FROM resb
        WHERE kdauf  = p_vbeln
        AND   ablad  = itab-sposnr+2.
    Here I am using 'KDAUF'  & 'ABLAD' in condition. Can we use secondary index for improving the performance in this case.
    Regards,
    Himanshu

    Hi ,
    Declare intenal table with only those four fields.
    and try the beloe code....
    SELECT aufnr posnr roms1 roanz
    INTO  table itab
    FROM resb
    WHERE kdauf = p_vbeln
    AND ablad = itab-sposnr+2.
    yes, you can also use secondary index for improving the performance in this case.
    Regards,
    Anand .
    Reward if it is useful....

  • Select data from two tables...!

    HI Experts...!
    i m a beginner user and i want to select data from two tables proj and prps.....using joins.....and internal tables i have written a code...
    SELECT prps~pspnr
           prps~objnr
           prps~psphi
           proj~ernam
           proj~erdat
           proj~pspnr
    INTO  table itab   -
    itab is internal table
    FROM prps inner join proj
    WHERE pspnr in p_no and prpspsphi = projpspnr.
    but there is error in from clause ..please help me....
    Advance thanx....

    Hi,
    check the sample code bellow above two reply will solve out your problem but one more extra line in your code pointed out bellow.
    TABLES: prps, proj.
    TYPES:  BEGIN OF ty_test,
            pspnr LIKE prps-pspnr,
            objnr LIKE prps-objnr,
            psphi LIKE prps-psphi,
            ernam LIKE proj-ernam,
            erdat LIKE proj-erdat,
            END OF ty_test.
    DATA: itab TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
    SELECT-OPTIONS: p_no FOR prps-pspnr.
    SELECT  prps~pspnr
            prps~objnr
            prps~psphi
            proj~ernam
            proj~erdat
    *        proj~pspnr " No need for this you have selected this in
    *     the first line because it is commone so you only need to select from any one
            INTO TABLE itab
    FROM prps INNER JOIN proj ON ( prps~pspnr = proj~pspnr  )
    WHERE prps~pspnr IN p_no.
    Best Regards,
    Faisal
    Edited by: Rob Burbank on Dec 24, 2009 12:24 PM

  • Problem while loading data from ODS to infoobject

    Hi guys,
    I am facing problem while loading data from <b>ODS to infoobject</b>.
    If I load data via PSA it works fine but
    if I load data without PSA its giving error as Duplicate records.
    Do u have any idea why it is so.
    Thanks in advance
    savio

    Hi,
    when you load the data via the PSA, what did you select? Serial or Paralel?
    If you select serial most likely you don't have duplicates within the same datapackage and your load can go through.
    Loading directly in the IObj will happen thefore if you have the same key in two different packages, the "duplicate records" will be raised; you can perhaps flag your IPack with the option "ignore duplicate records" as suggested...
    hope this helps...
    Olivier.

  • Selecting data from two tables

    I am trying to select data from two tables.  The only problem that I am running into, is that i am only seeing results from my 'uploads' table.  there is also a record in documents where user = 1 that should show up.  here is my sql:
    $userIDNum = 1;
    $sql="Select *
    from uploads, documents
    WHERE uploads.user = documents.user AND uploads.user = $userIDNum
    ORDER BY uploads.title ASC, documents.title ASC";

    You'll need to explain a little more about your data and what you are trying to accomplish. Your current sql will select all columns from both the uploads and documents tables but only rows where the user id in both tables match, AND the user id equals 1. Is that not what you are seeing? Where's the code that outputs the results?

  • How to select data from a table using a date field in the where condition?

    How to select data from a table using a date field in the where condition?
    For eg:
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
                                                      and bdatu = '31129999'.
    thanks.

    Hi Ramesh,
    Specify the date format as YYYYMMDD in where condition.
    Dates are internally stored in SAP as YYYYMMDD only.
    Change your date format in WHERE condition as follows.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and bdatu = <b>'99991231'.</b>
    I doubt check your data base table EQUK on this date for the existince of data.
    Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and <b> bdatu <= '99991231'.</b>
    Thanks,
    Vinay
    Thanks,
    Vinay

  • How to use for all entires clause while fetching data from archived tables

    How to use for all entires clause while fetching data from archived tables using the FM
    /PBS/SELECT_INTO_TABLE' .
    I need to fetch data from an Archived table for all the entries in an internal table.
    Kindly provide some inputs for the same.
    thanks n Regards
    Ramesh

    Hi Ramesh,
    I have a query regarding accessing archived data through PBS.
    I have archived SAP FI data ( Object FI_DOCUMNT) using SAP standard process through TCODE : SARA.
    Now please tell me can I acees this archived data through the PBS add on FM : '/PBS/SELECT_INTO_TABLE'.
    Do I need to do something else to access data archived through SAP standard process ot not ? If yes, then please tell me as I am not able to get the data using the above FM.
    The call to the above FM is as follows :
    CALL FUNCTION '/PBS/SELECT_INTO_TABLE'
      EXPORTING
        archiv           = 'CFI'
        OPTION           = ''
        tabname          = 'BKPF'
        SCHL1_NAME       = 'BELNR'
        SCHL1_VON        =  belnr-low
        SCHL1_BIS        =  belnr-low
        SCHL2_NAME       = 'GJAHR'
        SCHL2_VON        =  GJAHR-LOW
        SCHL2_BIS        =  GJAHR-LOW
        SCHL3_NAME       =  'BUKRS'
        SCHL3_VON        =  bukrs-low
        SCHL3_BIS        =  bukrs-low
      SCHL4_NAME       =
      SCHL4_VON        =
      SCHL4_BIS        =
        CLR_ITAB         = 'X'
      MAX_ZAHL         =
      tables
        i_tabelle        =  t_bkpf
      SCHL1_IN         =
      SCHL2_IN         =
      SCHL3_IN         =
      SCHL4_IN         =
    EXCEPTIONS
       EOF              = 1
       OTHERS           = 2
       OTHERS           = 3
    It gives me the following error :
    Index for table not supported ! BKPF BELNR.
    Please help ASAP.
    Thnaks and Regards
    Gurpreet Singh

  • How to select data from cluster table

    hi experts,
                   I have a report which picks data from bseg (cluster table ) for a month report it is taking around 4 minutes to process.I feel it is not good when take the report after some months.
    how to select data from these table???how to declare itab for these cluster tables????can we include any search condition or any other kind of internal table???
    please advice.
    mani

    Hi Manikandan,
    The following code may be helpful to understand how to select the data from cluster table.
    Types: Begin of ty_kna1,
    Kunnr type kna1-kunnr,
    adrnr type kna1-adrnr,
    end of ty_kna1,
    begin of ty_bseg,
    belnr type bseg-belnr,
    kunnr type bseg-kunnr,
    end of ty_bseg,
    begin of ty_final,
    belnr type bseg-belnr,
    kunnr type kna1-kunnr,
    adrnr type kna1-adrnr,
    end of ty_final.
    Data: it_kna1 type table of ty_kna1,
    wa_kna1 type ty_kna1,
    it_bseg type table of ty_bseg,
    wa_bseg type ty_bseg,
    it_final type table of ty_final,
    wa_final type ty_final.
    Select kunnr adrnr from kna1 into table it_kna1 where....
    if sy-subrc = 0.
    select belnr kunnr into table it_bseg for all entries in it_kna1 where kunnr = it_kna1-kunnr.
    endif.
    sort it_kna1 by kunnr.
    Loop at it_bseg into wa_bseg.
    move wa_bseg-belnr to wa_final-belnr.
    read table it_kna1 into wa_kna1 with kunnr = wa_bseg-kunnr binary search.
    if sy-subrc = 0.
    move: wa_kna1-kunnr to wa_final-kunnr,
    wa_kna1-belnr to wa_final-belnr.
    endif.
    append wa_final to it_final.
    clear wa_final.
    endloop.
    Loop at it_final into wa_final.
    write: / wa_final-belnr, wa_final-kunnr, wa_final-adrnr.
    endloop.
    Reward if useful.
    Thankyou,
    Regards.

Maybe you are looking for