Load the data from a text file into a table using pl/sql

Hi Experts,

I want to load the data from a text file (sample1.txt) to a table using pl/sql

I used the pl/sql code below

***********************************
declare
f utl_file.file_type;
s varchar2 (200);
c number: = 0;
Start
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. deles de lignes insérées: ' || c);
end;

***************************************

and my sample1.txt file looks like

***************************************
1
2
3
***************************************

Gets the data inserted, with way below

Select * from sampletable;

A, B AND C

1-1-1
2-2-2
3 3 3

I want that data to get inserted as

A, B AND C

1 2 3

The text file I have is to have three lines, and the first value of each line should go to each column

Help, please...

Thank you
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.

Tags: Database

Similar Questions

  • Importing data from a text file in 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.00
    I need to insert the data that it contains in 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 
    What is the easiest and best to proceed on this?

    Thank you
    Kevin

    If that's what you're looking for, then you can do

    with t
    as
    (
    select 'BILL_TO_RETAILER' col1 from dual union all
    select 'Some unwanted info' from dual union all
    select 'Some unwanted info' from dual union all
    select '==============' from dual union all
    select 'Actual Data' from dual union all
    select 'Actual Data' from dual union all
    select 'BILL_TO_RETAILER' from dual union all
    select 'Some unwanted info' from dual union all
    select 'Some unwanted info' from dual union all
    select '==============' from dual union all
    select 'Actual Data' from dual union all
    select 'Actual Data' from dual
    )
    select col1
      from (
             select col1, last_value(val ignore nulls) over(order by rno) val1
               from (
                     select t.*,
                            case when col1 = 'BILL_TO_RETAILER' then 1 when regexp_like(col1,'=+') then 0 else null end val,
                            rownum rno
                       from t
                    )
           )
     where val1 = 0
       and not regexp_like(col1,'=+')
    
  • How to load multiple files into multiple tables using a Controlfile?

    Hello world

    I have four different tables with similar structures, get the data from four different data files. I would like to use one control file to load the data from four different files from four different tables.

    Here's the DOF of the tables:

    CREATE TABLE Product_Sales(  
        Year_of_Sale NUMBER,  
        Product_Type VARCHAR2(25 CHAR),  
        Product_Group VARCHAR2(25 CHAR),  
        Category_Type VARCHAR2(25 CHAR),  
        Category_Group VARCHAR2(10 CHAR),  
        Product_Count NUMBER,  
        Product_Amount NUMBER(19,2),  
        Category_Count NUMBER,  
        Category_Amount NUMBER(19,2)  
    )  
    
    

    CREATE TABLE Retail_Sales(  
        Year_of_Sale NUMBER,  
        Product_Type VARCHAR2(25 CHAR),  
        Product_Group VARCHAR2(25 CHAR),  
        Category_Type VARCHAR2(25 CHAR),  
        Category_Group VARCHAR2(10 CHAR),  
        Product_Count NUMBER,  
        Product_Amount NUMBER(19,2),  
        Category_Count NUMBER,  
        Category_Amount NUMBER(19,2)  
    )  
    
    

    You still have products_sales instead of product_sales in when your article, so it does not load anything in the product_sales table.  You have not reset the position for the first after subsequent field in the table and when clauses, then it starts looking for the first field to the position you left it in the previous section, instead of 1, so he can't find anything and does load all the data in the household_sales table.  You need to reset the position 1 for each combination of table and what clause after the first.  The first argument is optional.  Please see the corrected below control file.

    DOWNLOAD THE DATA

    INFILE 'output.txt '.

    IN THE PRODUCT_SALES TABLE TRUNCATE

    WHEN filename = "Product_Sales".

    FIELDS ENDED BY ',' POSSIBLY FRAMED BY ' '.

    TRAILING NULLCOLS

    (

    file name of FILLING,

    Year_of_Sale,

    Product_Type,

    Product_Group,

    Category_Type,

    Category_Group,

    Product_Count,

    EXTERNAL DECIMAL Product_Amount,

    Category_Count,

    EXTERNAL DECIMAL Category_Amount

    )

    IN THE HOUSEHOLD_SALES TABLE TRUNCATE

    WHEN filename = "Household_Sales".

    FIELDS ENDED BY ',' POSSIBLY FRAMED BY ' '.

    TRAILING NULLCOLS

    (

    filename FILLER POSITION (1),

    Year_of_Sale,

    Household_Type,

    Product_Group FILLING,

    Category_Type FILLING,

    Category_Group FILLING,

    Product_Count,

    EXTERNAL DECIMAL Product_Amount,

    Category_Count,

    EXTERNAL DECIMAL Category_Amount

    )

  • Generic procedure to load the data from the source to the table target

    Hi all

    I want to create a generic procedure to load data of X number of the source table to X number of the target table.

    such as:

    Source1-> Target1

    Source2-> Target2

    -> Target3 Source3

    Each target table has the same structure as the source table.

    The indexes are same as well. Constraint are not predefined in the source or target tables.there is no involved in loading the data from the business logic.

    It would simply add.

    This procedure will be scheduled during off hours and probably only once in a month.

    I created a procedure that does this, and not like:

    (1) make a contribution to the procedure as Source and target table.

    (2) find the index in the target table.

    (3) get the metadata of the target table indexes and pick up.

    (4) delete the index above.

    (5) load the data from the source to the target (Append).

    (6) Re-create the indexes on the target table by using the collection of meta data.

    (7) delete the records in the source table.

    sample proc as: (logging of errors is missing)

    CREATE or REPLACE PROCEDURE PP_LOAD_SOURCE_TARGET (p_source_table IN VARCHAR2,

    p_target_table IN VARCHAR2)

    IS

    V_varchar_tbl. ARRAY TYPE IS VARCHAR2 (32);

    l_varchar_tbl v_varchar_tbl;

    TYPE v_clob_tbl_ind IS TABLE OF VARCHAR2 (32767) INDEX OF PLS_INTEGER;

    l_clob_tbl_ind v_clob_tbl_ind;

    g_owner CONSTANT VARCHAR2 (10): = 'STG '.

    CONSTANT VARCHAR2 G_OBJECT (6): = 'INDEX ';

    BEGIN

    SELECT DISTINCT INDEX_NAME BULK COLLECT

    IN l_varchar_tbl

    OF ALL_INDEXES

    WHERE table_name = p_target_table

    AND the OWNER = g_owner;

    FOR k IN l_varchar_tbl. FIRST... l_varchar_tbl. LAST LOOP

    SELECT DBMS_METADATA. GET_DDL (g_object,

    l_varchar_tbl (k),

    g_owner)

    IN l_clob_tbl_ind (k)

    FROM DUAL;

    END LOOP;

    BECAUSE me IN l_varchar_tbl. FIRST... l_varchar_tbl. LAST LOOP

    RUN IMMEDIATELY "DROP INDEX ' |" l_varchar_tbl (i);

    DBMS_OUTPUT. PUT_LINE (' INDEXED DROPED AS :'|| l_varchar_tbl (i));

    END LOOP;

    RUN IMMEDIATELY ' INSERT / * + APPEND * / INTO ' | p_target_table |

    ' SELECT * FROM ' | '. p_source_table;

    COMMIT;

    FOR s IN l_clob_tbl_ind. FIRST... l_clob_tbl_ind LAST LOOP.

    EXECUTE IMMEDIATE l_clob_tbl_ind (s);

    END LOOP;

    RUN IMMEDIATELY 'TRUNCATE TABLE ' | p_source_table;

    END PP_LOAD_SOURCE_TARGET;

    I want to know:

    1 has anyone put up a similar solution if yes what kind of challenges have to face.

    2. it is a good approach.

    3. How can I minimize the failure of the data load.

    Why not just

    create table to check-in as

    Select "SOURCE1" source, targets "TARGET1", 'Y' union flag double all the

    Select "SOURCE2', 'TARGET2', 'Y' in all the double union

    Select "SOURCE3', 'Target3', 'Y' in all the double union

    Select "SOURCE4', 'TARGET4', 'Y' in all the double union

    Select 'Source.5', 'TARGET5', 'Y' in double

    SOURCE TARGET FLAG
    SOURCE1 TARGET1 THERE
    SOURCE2 TARGET2 THERE
    SOURCE3 TARGET3 THERE
    SOURCE4 TARGET4 THERE
    SOURCE.5 TARGET5 THERE

    declare

    the_command varchar2 (1000);

    Start

    for r in (select source, target of the archiving of the pavilion where = 'Y')

    loop

    the_command: = "insert / * + append * / into ' |" r.Target | ' Select * from ' | '. r.source;

    dbms_output.put_line (the_command);

    -execution immediate the_command;

    the_command: = 'truncate table ' | r.source | "drop storage."

    dbms_output.put_line (the_command);

    -execution immediate the_command;

    dbms_output.put_line(r.source ||) 'table transformed');

    end loop;

    end;

    Insert / * + append * / into select destination1 * source1

    truncate table SOURCE1 drop storage

    Treated SOURCE1 table

    Insert / * + append * / to select TARGET2 * in SOURCE2

    truncate table SOURCE2 drop storage

    Treated SOURCE2 table

    Insert / * + append * / into select target3 * of SOURCE3

    truncate table SOURCE3 drop storage

    Treated SOURCE3 table

    Insert / * + append * / into TARGET4 select * from SOURCE4

    truncate table SOURCE4 drop storage

    Table treated SOURCE4

    Insert / * + append * / into TARGET5 select * from source.5

    truncate table source.5 drop storage

    Treated source.5 table

    Concerning

    Etbin

  • Average data from multiple text files

    I am new to labVIEW so any help is appreciated:

    I have a 100 txt files with two columns (separate tab) for a value of X and Y.

    I need the average of the values of Y to generate a single file and generate X against Y graph.

    So, how to read the data of these text files? (without having to select each one individually) and the average data and create a chart XY him?

    Thanks in advance

    There is a function to list folder in the palette of the file i/o that will return an array of file names.  Feed this table in a loop to open and read each file in turn.  Put in a new file, build a table with her, process the data or do whatever you want.

  • What is the fastest way bulk load the data from ACE / 400 to Oracle?

    Asked me to move data from the AS / 400 to Oracle11gR2 as fast that ODI may eventually. Quinte just no mapping, no transformation, no membership.

    An ODI11g agent is started on the computer of Oracle target, but being new ODI, I don't know how to use SQL for Oracle LKM loading in a scene and then updated incremental Oracle IKM layout from staging to the target table.

    It took 50 minutes to move recorded about 4 million. I need to get this in about 10 minutes. So guys, if there is a best practice to do this, please let me know, but now I'll try any suggestion you might think.

    Thank you in advance.

    Means the faster is to use a combination of ODI interface and ODI tool named OdiSqlUnload.
    N ° 1). Use the ODI OdiSqlUnload tool to export the data from the AS / 400 files in a flat file of the BONES.
    Step 2.) Use this flat file as source and LKM file for Oracle (SQLLDR) and Oracle IKM incremental update to load Oracle data.

    Your current path is slow because it operates on a row by row basis.

  • Load the data from txt

    Hello

    I just export the data in my cube, he geneates two text because of this file is more than 2 GB in size, one is xxxxx.txt, another is xxxxx_1.txt.

    My question is that if I load the data file above in the same cube, I should just specify the first file xxxxx.txt? It seems that I can't specify both text files?

    Thank you

    you only need to load the second file
    Or
    clear data and load the two

    Your choice, you will get the same results.

  • How to load the text file into a table and retrieve data line by line?

    I'm looking to help understand how to open a text file, each line in a table of load.  The data will be called to change the content of the text layer.  Thanks for any help.

    I did not test this code, but something like

    var a = [];

    var f = new File (Folder.desktop + "/ TestFile.txt");

    If (f.open ('r')) {}

    While (! f.eof) {}

    a.push (f.Readln ());

    }

    f.Close ();

    }

    Alert ("I read" + a.length + "lines in the file.");

    for (var i = 0; i)< a.length;="" i++)="">

    DoSomethingWithThisLine (a [i]); //<-- you="" need="" to="" write="">

    }

  • Loading data from a text file

    I have a text in a file archive data that contains various information (numeric and string) I need to load into various controls in a VI that was to open the file and look for some characters of beginning and end of loading?  The information was listed by the VI of control so can I just load a previous series of data using its path and file name of data control?

    I guess that the following numbers the "data OH are listed below:" is supposed to go in a 2D array?

    There are several ways to do so. A simple way is to simply read the file and cut each of the sections of interest and convert the string in a table 2D, like this:

    Another is to read the file using read the spreadsheet file, and then the index on the first column and use it to search for the clues where areas of interest. You can then use subset of the table to get the 2D data table.

  • How can I extract the data from a csv file and insert it into an Oracle table? (UTL_FILE)

    Hi, please help me whit this query

    Im trying to extrate the data in a file csv and im using the ULT_FILE package
    I have this query that read the file and the first field, but if the field has a different length does not work as it should

    For example if I had this .csv file:

    1, book, laptop

    2, pen, Eraser

    3, notebook, paper

    And in the table, I had to insert like this

    ID descrption1 description2

    laptop 1 book

    Eraser pen 2

    paper laptop 3

    For now, I have this query, which displays only with DBMS:

    Declare

    -Variables

    Cadena VARCHAR2 (32767).

    Vfile UTL_FILE. TYPE_DE_FICHIER;

    Dato varchar2 (200);                                             -Date

    dato1 varchar2 (200);

    dato2 varchar2 (200);

    Identifier varchar2 (5): = ', ';                             -Identifier (en)

    v_ManejadorFichero UTL_FILE. TYPE_DE_FICHIER;     -For exceptions

    -Table variables

    I_STATUS GL_INTERFACE. % OF STATUS TYPE.

    I_LEDGER_ID GL_INTERFACE. TYPE % LEDGER_ID;

    I_USER_JE_SOURCE_NAME GL_INTERFACE. TYPE % USER_JE_SOURCE_NAME;

    I_ACCOUNTING_DATE GL_INTERFACE. TYPE % ACCOUNTING_DATE;

    I_PERIOD_NAME GL_INTERFACE. TYPE % PERIOD_NAME;

    I_CURRENCY_CODE GL_INTERFACE. CURRENCY_CODE % TYPE;

    I_DATE_CREATED GL_INTERFACE. DATE_CREATED % TYPE;

    I_CREATED_BY GL_INTERFACE. CREATED_BY % TYPE;

    I_ACTUAL_FLAG GL_INTERFACE. TYPE % ACTUAL_FLAG;

    I_CODE_COMBINATION_ID GL_INTERFACE. TYPE % CODE_COMBINATION_ID;

    I_ENTERED_DR GL_INTERFACE. TYPE % ENTERED_DR;

    I_ENTERED_CR GL_INTERFACE. TYPE % ENTERED_CR;

    I_ACCOUNTED_DR GL_INTERFACE. TYPE % ACCOUNTED_DR;

    I_ACCOUNTED_CR GL_INTERFACE. TYPE % ACCOUNTED_CR;

    I_TRANSACTION_DATE GL_INTERFACE. TRANSACTION_DATE % TYPE;

    I_REFERENCE1 GL_INTERFACE. REFERENCE1% TYPE;

    I_REFERENCE2 GL_INTERFACE. REFERENCE2% TYPE;

    I_REFERENCE3 GL_INTERFACE. REFERENCE3% TYPE;

    I_REFERENCE4 GL_INTERFACE. REFERENCE4% TYPE;

    I_REFERENCE5 GL_INTERFACE. REFERENCE5% TYPE;

    I_REFERENCE10 GL_INTERFACE. REFERENCE10% TYPE;

    I_GROUP_ID GL_INTERFACE. GROUP_ID % TYPE;

    BEGIN

    Vfile: = UTL_FILE. FOPEN ('CAPEX_ENVIO', 'comas.csv', 'R');

    loop

    UTL_FILE. GET_LINE(Vfile,Cadena,32767);

    dato1: = substr (cadena, instr(cadena, identificador,1,1)-1, instr(cadena, identificador,1,1)-1);

    dato2: = substr (cadena, instr (cadena, identifier, 1, 1) + 1, instr(cadena, identificador,3,1)-3);

    dbms_output.put_line (dato1);

    dbms_output.put_line (dato2);

    -The evidence

    -dbms_output.put_line (cadena);

    -dbms_output.put_line (substr (dato, 3, instr(dato, identificador,1,1)-1));

    -dbms_output.put_line (substr (dato, instr (dato, identifier, 1, 2) + 1, instr(dato, identificador,1,1)-1));

    -dbms_output.put_line (substr (cadena, 1, length (cadena)-1));

    end loop;

    UTL_FILE. FCLOSE (Vfile);

    -----------------------------------------------------------------------------------EXCEPTIONS------------------------------------------------------------------------------------------------------------------------------------------------------------

    EXCEPTION

    When no_data_found then

    dbms_output.put_line ('Todo Correcto');

    When utl_file.invalid_path then

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20060,'RUTA DEL ARCHIVO NULLIFIED: (');)

    WHEN UTL_FILE. INVALID_OPERATION THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR ('-20061,'EL ARCHIVO NO PUDO SER ABIERTO ");

    WHEN UTL_FILE. INVALID_FILEHANDLE THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20062, 'INVALIDO MANAGER');

    WHEN UTL_FILE. WRITE_ERROR THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20063, 'ESCRITURA ERROR');

    WHEN UTL_FILE. INVALID_MODE THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20064, 'MODO INVALIDO');

    WHEN UTL_FILE. INTERNAL_ERROR THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20065, 'ERROR INTERNO');

    WHEN UTL_FILE. READ_ERROR THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20066, 'LECTURA ERORR');

    WHEN UTL_FILE. FILE_OPEN THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR ('-20067,'EL ARCHIVO ARE ESTA ABIERTO ");

    WHEN UTL_FILE. THEN ACCESS_DENIED

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20068, 'REFUSED ACCESS');

    WHEN UTL_FILE. DELETE_FAILED THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20069, 'OPERACIÓN BORRADO FALLO');

    WHEN UTL_FILE. RENAME_FAILED THEN

    UTL_FILE. FCLOSE (V_ManejadorFichero);

    RAISE_APPLICATION_ERROR (-20070, 'OPERATION SOBREESCRITURA FALLO');

    END;

    Hello

    Try something like this:

    POS1: = INSTR (cadena, idntificador, 1, 1);
    POS2: = INSTR (cadena, idntificador, 1, 2);

    ID: = SUBSTR (cadena, 1, pos1 - 1);
    description1: = SUBSTR (cadena, pos1 + 1, (pos2 - pos1)-1);
    Description2: = SUBSTR (cadena, pos2 + 1);

    where pos1 and pos2 are numbers.

    Rather than use UTL_FILE, consider creating an external table.  You won't have to write any PL/SQL, and this means that you won't be tempted to write a bad article of EXCEPTION.

  • Error in laoding data from a text file

    Hello Experts,

    I have some difficulty to well to be honest a lot of problems with the next file.

    I have this text file that I need to import into my oracle table.

    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.00
     0200119 Amba Veerapen                  Amba Veerapen                  111111111  62030100129436            34,656.00            0.00       34,656.00
     0200121 Tang Way                       Tang Way                       111111111  111111111                 79,002.00            0.00       79,002.00
     0200122 Football Pools Collector       Football Pools Collector       111111111  111111111                 17,024.00            0.00       17,024.00
     0200123 Kim Lee                        Kim Lee                        111111111  62030100129422            18,544.00            0.00       18,544.00
     0200126 Chez Andrex                    Chez Andrex                    111111111  111111111                113,734.00            0.00      113,734.00
     0200127 Sungkoora Pools & Lottery Hous Sungkoora Pools & Lottery Hous 111111111  111111111                 77,368.00            0.00       77,368.00
     0200128 Sun Boutik                     Sun Boutik                     111111111  62030100131324            21,033.00            0.00       21,033.00
     0200129 Guranna Pools House            Guranna Pools House            111111111  111111111                 51,661.00            0.00       51,661.00
     0200130 AH King                        AH King                        111111111  111111111                 19,475.00            0.00       19,475.00
     0200131 S. D. S Pools House            S. D. S Pools House            111111111  62030100129409            25,346.00            0.00       25,346.00
    Code for import
    CREATE TABLE weekly_eft_temp
    (
      Bill_to_Retailer       NUMBER(7),
      Retailer_Name          VARCHAR2(80 BYTE),
      Name_on_Bank_Account   VARCHAR2(80 BYTE),
      Bank_ABA               NUMBER(9),
      Bank_Acct              VARCHAR2(20 BYTE),
      On_line_Amount         NUMBER(10,2),
      Instant_Amount         NUMBER(10,2),
      Total_Amount           NUMBER(10,2)
    )
    ORGANIZATION EXTERNAL
      (  TYPE ORACLE_LOADER
         DEFAULT DIRECTORY GTECHFILES
         ACCESS PARAMETERS 
           ( RECORDS FIXED 150 FIELDS --includes new line character
          LRTRIM 
          MISSING FIELD VALUES ARE NULL 
           (Bill_to_Retailer      (1:8)     CHAR(9), 
            Retailer_Name         (10:39)   CHAR(30), 
            Name_on_Bank_Account  (41:70)   CHAR(30), 
            Bank_ABA              (72:81)   CHAR(10),
            Bank_Acct             (83:102)  CHAR(20)
            On_line_Amount        (104:118) CHAR(15), 
            Instant_Amount        (120:134)  CHAR(15), 
            Total_Amount          (136:150)   CHAR(15) 
           ) 
           )
         LOCATION ('weekly_eft_report_c00381.rep')
      )
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    NOMONITORING;
    but I have the following error

    Error
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-00554: error encountered while parsing access parameters
    KUP-01005: syntax error: found "minussign": expecting one of: "column, enclosed, exit, (, ltrim, lrtrim, ldrtrim, missing, notrim, optionally, rtrim, reject, terminated"
    KUP-01007: at line 1 column 26
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
    Can someone help me please. Thank you

    Published by: Kevin CK on February 25, 2010 03:33

    Kevin CK wrote:
    OK, now, I have only this error

    You must ignore the header - 7 first lines:

    SQL> CREATE TABLE weekly_eft_temp
      2  (
      3    Bill_to_Retailer       VARCHAR2(9),
      4    Retailer_Name          VARCHAR2(80 BYTE),
      5    Name_on_Bank_Account   VARCHAR2(80 BYTE),
      6    Bank_ABA               NUMBER(9),
      7    Bank_Acct              VARCHAR2(20 BYTE),
      8    On_line_Amount         VARCHAR2(15),
      9    Instant_Amount         VARCHAR2(15),
     10    Total_Amount           VARCHAR2(15)
     11  )
     12  ORGANIZATION EXTERNAL
     13    (  TYPE ORACLE_LOADER
     14       DEFAULT DIRECTORY GTECHFILES
     15       ACCESS PARAMETERS
     16         ( records delimited by newline
     17        LOGFILE 'weekly_eft_report_c00381.log'
     18        SKIP 7
     19        FIELDS LDRTRIM
     20        MISSING FIELD VALUES ARE NULL
     21         (Bill_to_Retailer      (1:8)     CHAR(9),
     22          Retailer_Name         (10:39)   CHAR(30),
     23          Name_on_Bank_Account  (41:70)   CHAR(30),
     24          Bank_ABA              (72:81)   CHAR(10),
     25          Bank_Acct             (83:102)  CHAR(20),
     26          On_line_Amount        (104:118) CHAR(15),
     27          Instant_Amount        (120:134)  CHAR(15),
     28          Total_Amount          (136:150)   CHAR(15)
     29         )
     30     )
     31       LOCATION ('weekly_eft_report_c00381.rep')
     32  )
     33  REJECT LIMIT UNLIMITED
     34  NOPARALLEL
     35  NOMONITORING
     36  /
    
    Table created.
    
    SQL> SELECT  BILL_TO_RETAILER,
      2          RETAILER_NAME,
      3          NAME_ON_BANK_ACCOUNT,
      4          BANK_ABA,
      5          BANK_ACCT,
      6          TO_NUMBER(ON_LINE_AMOUNT,'999,999,999.00') ON_LINE_AMOUNT,
      7          TO_NUMBER(INSTANT_AMOUNT,'999,999,999.00') INSTANT_AMOUNT,
      8          TO_NUMBER(TOTAL_AMOUNT,'999,999,999.00') TOTAL_AMOUNT
      9    FROM  weekly_eft_temp
     10  /
    
    BILL_TO_R 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                10868              0        10868
     0200103  Le Cacharel Snack                                  Le Cacharel Snack               111111111 62030100130813                 9728              0         9728
     0200104  Advanced Co-operative Self Ser                     Advanced Co-operative Self Ser  111111111 111111111                      7334              0         7334
     0200105  Chez Popo Supermarket                              Chez Popo Supermarket           111111111 61030100044898                30932              0        30932
     0200106  Vana Supermarket                                   Vana Supermarket                111111111 111111111                     17775              0        17775
     0200107  Mont Choisy Store                                  Mont Choisy Store               111111111 62030100130804                 8840              0         8840
     0200108  Vijay Store                                        Vijay Store                     111111111 62030100131229                16416              0        16416
     0200109  Neptune Confection                                 Neptune Confection              111111111 62030100130931                11077              0        11077
     0200110  Antoine Store                                      Antoine Store                   111111111 111111111                      2470              0         2470
     0200111  P.S.C Cold Storage                                 P.S.C Cold Storage              111111111 111111111                     10431              0        10431
     0200113  Mini Prix Boutique                                 Mini Prix Boutique              111111111 62030100131501                26315              0        26315
    
    BILL_TO_R RETAILER_NAME                                      NAME_ON_BANK_ACCOUNT             BANK_ABA BANK_ACCT            ON_LINE_AMOUNT INSTANT_AMOUNT TOTAL_AMOUNT
    --------- -------------------------------------------------- ------------------------------ ---------- -------------------- -------------- -------------- ------------
     0200114  Hotel Cassim                                       Hotel Cassim                    111111111 111111111                    135147              0       135147
     0200116  Aman Snack                                         Aman Snack                      111111111 62030100129481                 7334              0         7334
     0200117  Best For Less Company Ltd                          Best For Less Company Ltd       111111111 111111111                      3325              0         3325
     0200118  Central Way                                        Central Way                     111111111 111111111                     25137              0        25137
     0200119  Amba Veerapen                                      Amba Veerapen                   111111111 62030100129436                34656              0        34656
     0200121  Tang Way                                           Tang Way                        111111111 111111111                     79002              0        79002
     0200122  Football Pools Collector                           Football Pools Collector        111111111 111111111                     17024              0        17024
     0200123  Kim Lee                                            Kim Lee                         111111111 62030100129422                18544              0        18544
     0200126  Chez Andrex                                        Chez Andrex                     111111111 111111111                    113734              0       113734
     0200127  Sungkoora Pools & Lottery Hous                     Sungkoora Pools & Lottery Hous  111111111 111111111                     77368              0        77368
     0200128  Sun Boutik                                         Sun Boutik                      111111111 62030100131324                21033              0        21033
    
    BILL_TO_R RETAILER_NAME                                      NAME_ON_BANK_ACCOUNT             BANK_ABA BANK_ACCT            ON_LINE_AMOUNT INSTANT_AMOUNT TOTAL_AMOUNT
    --------- -------------------------------------------------- ------------------------------ ---------- -------------------- -------------- -------------- ------------
     0200129  Guranna Pools House                                Guranna Pools House             111111111 111111111                     51661              0        51661
     0200130  AH King                                            AH King                         111111111 111111111                     19475              0        19475
     0200131  S. D. S Pools House                                S. D. S Pools House             111111111 62030100129409                25346              0        25346
    
    25 rows selected.
    
    SQL> 
    

    SY.

  • How to extract specific data from a text file

    Hello world

    For my project, it is necessary that a parameter file is read at the beginning, so that variables be initialized with specific values that change with the user.

    For now, the mode of action is as follows: the values in a sequence specified in a text file are read and saved in a table and the elements of the array are extracted according to their index.

    The problem with this implementation is, that if for any reason any changes file format, for example we want to use a settings file from a previous version of the program, which has the values for the variables of same but in a different order, the only way to have good values for the parameters is to change everything accordingly which is really time wasting.

    Could someone suggest another implementation that make reading the different values independently of their order in the file, for example by analysing the file for specific strings and by reading the value after the string?

    Thank you very much.

    P.S. I've attached a screenshot of the routine, which I use now.

    Hi panagiov,

    Find attached files.

    Method 1: in this you can search for each variable separately. You can use "Live Config file" to get all the keys (variable) at a time, and then you can use for loop to get their values. Or you can access values as indicated in the present code.

    Method 2: Here you will have all the data at once. You will get variables and data (table 2D), you should look for the variables as needed.

    I hope you understand these methods.

    Good luck

  • Read data from a text file

    Hi, using Cp 8.01.

    I would like to read the textual data to a text or XML file into a variable in order to display a message (using a form) on my project of Cp can I do this without using Javascript?

    Thank you.

    You need JS.

  • Load the data from table to table index

    Hello

    We need to load index per table to table data. The code below works fine.

    declare
    query varchar2(200);
    Type l_emp is TABLE OF emp%rowtype INDEX BY Binary_Integer;
    rec_1 l_emp;
    
    begin
    query :=' SELECT * FROM emp';
     EXECUTE IMMEDIATE query BULK COLLECT INTO rec_1 ;
    
    For ALL  i   in rec_1 .First .. rec_1 .Last
    Insert Into emp_b
            values rec_1 (i);
    end;
    /
    

    But data from the source table and the target table are dynamic.

    Ex:

    In code, above table emp (source) and target is emp_b are static.

    But for our scenario is dependent on the source table, target would change as below.

    If source is emp target is emp_b

    If source is emp1 target is emp_b1...

    create or replace procedure p(source in varchar2, target in varchar2)
    as
    query varchar2(200);
    source varchar2(200);
    Type l_emp is TABLE OF emp%rowtype INDEX BY Binary_Integer;
    rec_1 l_emp;
    
    begin
    query :=' SELECT * FROM ' || source;
     EXECUTE IMMEDIATE query BULK COLLECT INTO rec_1 ;
    
    For ALL i   in rec_1 .First .. rec_1 .Last
     execute immediate 'INSERT INTO ' || target || ' values ' ||rec_1(i);
    end;
    /
    
    
    

    His throw. How to implement this scenario... Please help with that?

    No particular reason to use to COLLECT EVERYTHING & BULK here? Why not ordinary

    INSERT INTO target
    SELECT * FROM source;
    

    However if that's what you need you need a dynamic PLSQL block, which comes with additional side effects (code SQL injection). Dynamic SQL is not here.

    Kind regards

  • Can we use Source accounting entity group to load the data from multiple entities with a single rule to load?


    Page 79 of erpi_admin_11123200.pdf says that "reporting entity groups are used to extract data from several reporting entities in a single data rule execution.  I use standard EBS adapter to load data in HFM application, I created a group of entity made up of several accounting entities, but I can't find a place in FDMEE where you get to select/use this group... When you define an import format you type the name and select Source (e, g. EBS) system you can select Map Source (for example EBS11 I adapter) or the accounting entity (it is what I select to define data load maps), but not both.  Note that there is no place to select the Group of accounting entity...  Location check menu group entity drop-down but it doe not my group of accounting entity which I believe is anyway something different... and creating a location and pointing to a format compatible with the selected Source adapter is no not good either... I'm confused, so is it possible to load data from several reporting entities in one rule to load or am I misreading the documentation?  Thank you in advance.

    Do not leave the field blank in the Import Format. If leave you empty to the place, when you set the rule to load data (for the location with EBS as a Source system), you will be able to select a single accounting entity or a group of accounting entity.

    You can see here

    Please mark this as useful or answer question so that others can see.

    Thank you

Maybe you are looking for