Export records into a flat file

Hi...
I have to export some tables into a flat file. The output must be like this:
insert into table (col1, col2.....) value (one, two......)
insert into table (col1, col2.....) value (one, two......)
insert into table (col1, col2.....) value (one, two......)
how can I do that.......with PLSQL code?
Thanks
Message was edited by:
marckcos

I got this package : and I got the follwing error:
4:35:19 PM Execution failed: ORA-20011: GENERATE_STMT Error in populating file. Message: ORA-00904: "CHANGE_DATATYPE": invalid identifier
What can I do?
CREATE OR REPLACE PACKAGE BODY UTILITY
IS
-- VARIABLES USED by PROCEDURE generate_stmt
-- File Related PACKAGE Variable
cmn_file_handle UTL_FILE.file_type;
PROCEDURE close_file
IS
BEGIN
UTL_FILE.FCLOSE (cmn_file_handle);
EXCEPTION
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
RAISE_APPLICATION_ERROR(-20003, 'File handle was invalid');
WHEN UTL_FILE.INVALID_PATH THEN
RAISE_APPLICATION_ERROR(-20004, 'Invalid path for file');
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20005, 'CLOSE_FILE Error in creating file. Message: ' || SQLERRM);
END close_file;
PROCEDURE open_file (
prm_output_folder IN VARCHAR2,
prm_output_file IN VARCHAR2)
IS
BEGIN
cmn_file_handle := UTL_FILE.FOPEN (prm_output_folder, prm_output_file, 'a', 32767);
EXCEPTION
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
close_file;
RAISE_APPLICATION_ERROR(-20000, 'File handle was invalid');
WHEN UTL_FILE.INVALID_PATH THEN
close_file;
RAISE_APPLICATION_ERROR(-20001, 'Invalid path for file');
WHEN OTHERS THEN
close_file;
RAISE_APPLICATION_ERROR(-20002, 'OPEN_FILE Error in creating file. Message: ' || SQLERRM);
END open_file;
FUNCTION change_datatype (
prm_value IN VARCHAR2,
prm_data_type IN VARCHAR2)
RETURN VARCHAR2
IS
BEGIN
IF prm_value IS NULL THEN
RETURN ('NULL');
END IF;
IF prm_data_type = 'C' THEN
IF INSTR(prm_value, CHR(10)) > 0 THEN
RETURN ('REPLACE(' || '''' || REPLACE (prm_value, CHR(10), CHR(977)) || '''' || ', CHR(977), CHR(10))');
END IF;
ELSIF prm_data_type = 'D' THEN
RETURN ('TO_DATE(' || '''' || prm_value || '''' || ', ' || '''' || 'DD-MON-YYYY HH24:MI:SS' || '''' || ')');
ELSIF prm_data_type = 'N' THEN
RETURN (prm_value);
END IF;
RETURN ('''' || prm_value || '''');
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20002, 'CHANGE_DATATYPE Error in Converting DataType. Message: ' || SQLERRM);
END change_datatype;
PROCEDURE generate_stmt (
prm_table_name IN VARCHAR2,
prm_where_clause IN VARCHAR2,
prm_output_folder IN VARCHAR2,
prm_output_file IN VARCHAR2)
IS
TYPE ref_cols IS REF CURSOR;
mmy_ref_cols ref_cols;
mmy_column_name VARCHAR2(100);
mmy_column_data_type VARCHAR2(1);
mmy_col_string VARCHAR2(32767);
mmy_query_col_string VARCHAR2(32767);
BEGIN
IF prm_table_name IS NULL OR
prm_output_folder IS NULL OR
prm_output_file IS NULL THEN
RAISE_APPLICATION_ERROR(-20012, 'Invalid Argument Passed');
END IF;
OPEN mmy_ref_cols
FOR SELECT LOWER(column_name) column_name,
DECODE (data_type, 'VARCHAR2', 'C', 'CHAR', 'C', 'LONG', 'C', 'NUMBER', 'N', 'DATE', 'D') data_type
FROM user_tab_columns
WHERE table_name = UPPER(prm_table_name)
ORDER BY column_id;
LOOP
FETCH mmy_ref_cols INTO mmy_column_name, mmy_column_data_type;
EXIT WHEN mmy_ref_cols%NOTFOUND;
mmy_col_string := mmy_col_string || mmy_column_name || ', ';
IF mmy_column_data_type = 'D' THEN
mmy_query_col_string := mmy_query_col_string || 'change_datatype(' || 'TO_CHAR(' || mmy_column_name || ', ' || '''' || 'DD-MON-YYYY HH24:MI:SS' || '''' || ')' || ', ' || '''' || mmy_column_data_type || '''' || ') || ' || '''' || ', ' || '''' || ' || ';
ELSIF mmy_column_data_type IN ('N', 'C') THEN
mmy_query_col_string := mmy_query_col_string || 'change_datatype(' || mmy_column_name || ', ' || '''' || mmy_column_data_type || '''' || ') || ' || '''' || ', ' || '''' || ' || ';
END IF;
END LOOP;
CLOSE mmy_ref_cols;
IF mmy_col_string IS NOT NULL AND
mmy_query_col_string IS NOT NULL THEN
IF NOT UTL_FILE.IS_OPEN(cmn_file_handle) THEN
open_file(prm_output_folder, prm_output_file);
END IF;
mmy_col_string := 'INSERT INTO ' || LOWER(prm_table_name) || ' (' || CHR(10) || CHR(9) || CHR(9) || mmy_col_string;
mmy_col_string := RTRIM (mmy_col_string, ', ');
mmy_col_string := mmy_col_string || ')' || CHR(10) || 'VALUES ( ' || CHR(9);
mmy_query_col_string := RTRIM (mmy_query_col_string, ' || ' ||'''' || ',' || '''' || ' || ') || ' one_pare';
OPEN mmy_ref_cols
FOR ' SELECT ' || mmy_query_col_string ||
' FROM ' || prm_table_name ||
' ' || prm_where_clause;
LOOP
FETCH mmy_ref_cols INTO mmy_query_col_string;
EXIT WHEN mmy_ref_cols%NOTFOUND;
mmy_query_col_string := mmy_query_col_string || ');';
UTL_FILE.put (cmn_file_handle, mmy_col_string);
UTL_FILE.put_line (cmn_file_handle, mmy_query_col_string);
END LOOP;
CLOSE mmy_ref_cols;
If UTL_FILE.IS_OPEN(cmn_file_handle) THEN
close_file;
END IF;
END IF;
EXCEPTION
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
IF mmy_ref_cols%ISOPEN THEN
CLOSE mmy_ref_cols;
END IF;
close_file;
RAISE_APPLICATION_ERROR(-20009, 'File handle was invalid');
WHEN UTL_FILE.INVALID_PATH THEN
IF mmy_ref_cols%ISOPEN THEN
CLOSE mmy_ref_cols;
END IF;
close_file;
RAISE_APPLICATION_ERROR(-20010, 'Invalid path for file');
WHEN OTHERS THEN
IF mmy_ref_cols%ISOPEN THEN
CLOSE mmy_ref_cols;
END IF;
close_file;
RAISE_APPLICATION_ERROR(-20011, 'GENERATE_STMT Error in populating file. Message: ' || SQLERRM);
END generate_stmt;
END utility;
############################################################

Similar Messages

  • What is the best way to export the data out of BW into a flat file on the S

    Hi All,
    We are BW 7.01 (EHP 1, Service Pack Level 7).
    As part of our BW project scope for our current release, we will be developing certain reports in BW, and for certain reports, the existing legacy reporting system based out of MS Access and the old version of Business Objects Release 2 would be used, with the needed data supplied from the BW system.
    What is the best way to export the data out of BW into a flat file on the Server on regular intervals using a process chain?
    Thanks in advance,
    - Shashi

    Hello Shashi,
    some comments:
    1) An "open hub license" is required for all processes that extract data from BW to a non-SAP system (including APD). Please check with your SAP Account Executive for details.
    2) The limitation of 16 key fields is only valid when using open hub for extracting to a DB table. There's no such limitation when writing files.
    3) Open hub is the recommended solution since it's the easiest to implement, no programming is required, and you don't have to worry much about scaling with higher data volumes (APD and CRM BAPI are quite different in all of these aspects).
    For completeness, here's the most recent documentation which also lists other options:
    http://help.sap.com/saphelp_nw73/helpdata/en/0a/0212b4335542a5ae2ecf9a51fbfc96/frameset.htm
    Regards,
    Marc
    SAP Customer Solution Adoption (CSA)

  • Export multiple tables into one flat file

    I have data in multiple tables on a processing database that I need to move up to a production database. I want to export the data into a flat file, ftp it to the production server and have another job pick up the file and process it. I am looking for
    design suggestions on how to get multiple tables into one flat file using SSIS?
    Thank You.

    Hey,
    Without a bit more detail, as per Russels response, its difficult to give an exact recommendation.
    Essentially, you would first add a data flow task to your control flow.  Create a source per table, then direct the output of each into an union all task.  The output from the union all task would then be directed to a flat file destination.
    Within the union all task you can map the various input columns into the appropriate outputs.
    If the sources are different, it would probably be easiest to add a derived column task in-between the source and the union all, adding columns as appropriate and setting a default value that can be easily identified later (again depending on your requirements).
    Hope that helps,
    Jamie

  • Saving records to a flat file

    Dearest experts,
    I do need your kindest assistance.
    I have over 15 fieldnames from 11 tables.
    Some of these fieldnames are mandatory fieldnames and others are optional.
    The users are instructed to enter 'NA' to any to any fieldname that doesn't have a value.
    So far, that has not been the case. Sometimes, they enter 'NA' to some fieldnames.
    Some other times, they leave them blank. So, there is really noway to know which fieldnames would be left blank, we are forced now to come up with pl/sql script that will do 2 things:
    1, select all of those 15 records, and with the help of an if else statement, or even CASE or DECODE, come up with a catch_all code that is something like:
    if this fieldname is blank, assign 'NA' to it.
    2, Save the newly corrected records to a flat file.
    I will be forever indebted if you can give me a hand on this.
    Thanks very much.

    Great guy, thank you Warren!
    a couple of more follow-ups, please?
    Silly question 1, does NVL work with numeric values like 0 as well?
    Second, if I need to trim some stuff off and I need to use something like Substr, can I fit that into NVL?
    Thank you soooo very much

  • Saving database records in a flat file

    I am trying to save data from relational database into a flat file and then read back records based on the certain criteria.
    What will be a good approach for me? Should I use random access files or sequential files for storing and
    retrieving data or is there some other technique that is more efficient that I can use.
    Thanks

    I don't think that reading database records from a flat file based on certain criteria is a good approach, no matter how you produce the flat file. Using a second database table makes more sense to me, especially since you already have database software available and ready for use.
    (You asked about a "good approach" and then you wanted a technique that was "more efficient". Those two aren't the same thing at all.)

  • XML data (Output) into a flat file

    I need to convert XML data into a flat file, which is having "|" as delimiter and ftp the same to a server. The XML data is an output of BPEL activity. The XML data is employee records. Each employee records should come as one line in the flat file.
    Is it possible to do this? if so, what will be the steps
    Thanks

    Hi,
    You need to use file adapter to write your XML payload as a flat file.
    Following are the steps to write XML payload into a flat file:
    1. Create a sample flat file and add few rows in which fields should be delimited with pipe symbol. See the record sample given below:
    Name|Age|Address|City|State|Zip
    Sam|32|2788 Viking Dr|Green Bay|WI|54304
    Here first row is the header row, you can remove the header row if it is not required.
    2. Create a file adapter service using adapter configuration wizard. Give file name and folder location where you want to write flat file. On step 5 of the adapter configuration wizard you have to define or select message schema. Click on Define Schema for Native Format button, then Native Format Builder Wizard will be opened, here you can define message schema for your flat file.
    2.1 Here you need to select Delimited for file type.
    2.2 Give details about your flat file, select your sample flat file here, which you have created in step 1 above.
    2.3 Click Next button twice and go to step 4, here give namespace and element names you want and click on Next.
    2.4 In step 5 you need to specify delimiters. Wizard doesn’t shows *|* as a delimiter so you need to enter *|* in the Delimited By combo box and click on Next button.
    2.5 Complete remaining steps and click on Finish in the wizard.
    3. Finish "Adapter Creation Wizard". Add BPEL activities (assign, invoke) to pass XML payload to file adapter and file adapter will generate *|* delimited flat file and write it to the given folder.
    See the following article for more details on Native Format Builder Wizard:
    http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/nfb.htm#CCHCIGCA
    Regards,
    Dharmendra
    http://soa-howto.blogspot.com

  • Download report into a flat file format

    Hi Friends,
    I would like to know your thoughts on what is the best practice most of you using to download a report into a flat file(NOT csv).
    In my application business users want a report to be downloaded into their local desktop (just like a .csv) but into a flat file and they have their byte specific format.
    My concerns :
    1) Is there any straight method to download a report into a flatfile (like it is now for CSV) from Apex 3.1.2 ?
    2) If I write my own code using UTL_FILE, can I let the user to save them to their desired directory on their desktop ?
    Your thoughts would definitely help me in delivering a right solution to the users in this regard.
    Thanks a lot.
    Raj.

    Raj:
    You could create a 'Before Header' page process to create this 'flat file'. The code for the page process will be something similar to declare
    v_file_name   VARCHAR2 (2000) := 'fixedFieldsFile.txt';
    --- Client Record Format
    f1 char(20);
    f2 char(20);
    f3 char(20);
    ---- End format
    begin
    OWA_UTIL.mime_header ('application/txt', FALSE);
    htp.p('Content-Disposition:attachment;filename="'|| v_file_name|| '"');
    OWA_UTIL.http_header_close;
    for c1 in (select * from emp) loop                           ----- The report query
    f1:= c1.empno;f2:=c1.ename;f3:=c1.sal;
    htp.p(f1||f2||f3);
    end loop;
    apex_application.g_unrecoverable_error:=true;
    exception when others then
    null;
    end; Varad

  • How to split column wise into separate flat files in ssis

    IN SSIS...
    1.---->I have a sales table country wise regions  like (india, usa, srilanka) ....
    india usa
    srilanka
    a b
    c
    d e
    f
    so i want output like in
    flat file1.txt has india               flat file2.txt has usa             flat file3.txt has srilanka
         a b
    c
         d e
    f
    2.----->i dont know how many regions in my table....dynamically split into separate flat files ....
     pls help me.....thank u

    I think what you can do is this
    1. Do a query based on UNPIVOT to get the data as rows instead of columns
    For that you can use a query like this
    IF OBJECT_ID('temp') IS NOT NULL DROP TABLE temp
    CREATE TABLE temp
    Country varchar(100),
    Val decimal(25,5)
    DECLARE @CountryList varchar(3000),@SQL varchar(max)
    SELECT @CountryList = STUFF((SELECT ',[' + Column_Name + ']' FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '<SalesTableNameHere>' FOR XML PATH('')),1,1,'')
    SET @SQL= 'SELECT * FROM <SalesTableNameHere> t UNPIVOT (Val FOR Country IN (' + @CountryList + '))p'
    INSERT temp
    EXEC (@SQL)
    Once this is done you'll get data unpivoted to table
    Then you can use a execute sql task with query like above
    SELECT DISTINCT Country FROM Temp
    Use resultset option as full resultset and store the result to an object variable
    Then add a ForEach loop container with ADO enumerator and map to the object variable created above. Have variables inside loop to get inidvidual country values out.
    Inside loop place a data flow task. Use a variable to store source query , make EvaluateAsExpression true for it and set Expression as below
    "SELECT Val FROM Temp WHERE Country = " + @[User::LoopVariable]
    Where LoopVariable is variable created inside loop for getting iterated values
    Inside data flow task place a oledb source, choose option as  SQL command from variable and map to the above query variable.
    Link this to flat file destination create a flat file connection manager. Set a dynamic flat file connection using expression builder. Make it based on a variable and set variable to increment based on loop iteration
    The core logic looks similar to this
    http://visakhm.blogspot.ae/2013/09/exporting-sqlserver-data-to-multiple.html
    dynamic file naming can be seen here
    http://jahaines.blogspot.ae/2009/07/ssis-dynamically-naming-destination.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • DOWNLOAD CHEQUE FORMAT INTO A FLAT FILE

    hi,
       i have a requirement to download cheque format into  a flat file.
    as shown below. can any one guide me in this.
                                    Check No.   Date      Payment Amt
                                     1200175681  16/05/07           229.26  CAD
      Pay     TWO HUNDRED TWENTY NINE & 26/100*************************** CANADIAN D
      To The  MINISTER OF FINANCE
      Order   BARRIE SMALL CLAIMS COURT
      Of      114 WORSLEY STREET
              BARRIE ON L4M 1M1                  ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      BARRIESMCC                     1200175681   16/05/07
      Payee
      MINISTER OF FINANCE
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 BARRIESMCC02MAY                          0.00 CAD           229.26
                                                                                    Check No.   Date      Payment Amt
                                     1200175682  16/05/07           149.96  CAD
      Pay     ONE HUNDRED FORTY NINE & 96/100**************************** CANADIAN D
      To The  BELLEVILLE ONTARIO HRDC
      Order   REMITTANCES
      Of      PO BOX 6767
              MATANE QC G4W 4T1                  ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      BELLEVONHR                     1200175682   16/05/07
      Payee
      BELLEVILLE ONTARIO HRDC
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 HRDCQC09MAY07                            0.00 CAD           149.96
                                                                                    Check No.   Date      Payment Amt
                                     1200175683  16/05/07         1,590.00  CAD
      Pay     ONE THOUSAND FIVE HUNDRED NINETY & 00/100****************** CANADIAN D
      To The  CANADIAN ENERGY EFFICIENCY
      Order   ALLIANCE
      Of      2800 SKYMARK AVENUE
              MISSISSAUGA ON L4W 5A6             ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      CANENERGEF   02                1200175683   16/05/07
      Payee
      CANADIAN ENERGY EFFICIENCY
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      11/05/07 2117                                     0.00 CAD         1,590.00
                                                                                    Check No.   Date      Payment Amt
                                     1200175684  16/05/07         8,701.83  CAD
      Pay     EIGHT THOUSAND SEVEN HUNDRED ONE & 83/100****************** CANADIAN D
      To The  CITY OF HAMILTON
      Order   ACCOUNTS RECEIVABLE
      Of      120 KING ST WEST
              SUITE 900, STANDARD LIFE BLDG      ______________________________
              HAMILTON ON L8P 4V2
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      CITYHAMIL    01                1200175684   16/05/07
      Payee
      CITY OF HAMILTON
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      12/04/07 112949                                   0.00 CAD         8,701.83
                                                                                    Check No.   Date      Payment Amt
                                     1200175685  16/05/07        23,104.38  CAD
      Pay     TWENTY THREE THOUSAND ONE HUNDRED FOUR & 38/100************ CANADIAN D
      To The  MINISTRY OF COMMUNITY AND
      Order   SOCIAL SERVICES,  DIRECTOR
      Of      FAMILY RESPONSIBILITY OFFICE
              PO BOX 2204  STATION P             ______________________________
              TORONTO ON M5S 3E9
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      FAMILYREOF                     1200175685   16/05/07
      Payee
      MINISTRY OF COMMUNITY AND
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 FRO02MAY07                               0.00 CAD        23,104.38
                                                                                    Check No.   Date      Payment Amt
                                     1200175686  16/05/07           553.85  CAD
      Pay     FIVE HUNDRED FIFTY THREE & 85/100************************** CANADIAN D
      To The  HAROLD MCQUAKER ENTERPRISES
      Order   LTD
      Of      BOX 538
              EMO ON P0W 1E0                     ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      HAROLDMCEN                     1200175686   16/05/07
      Payee
      HAROLD MCQUAKER ENTERPRISES
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      17/03/07 121                                      0.00 CAD           553.85
                                                                                    Check No.   Date      Payment Amt
                                     1200175687  16/05/07       428,684.44  CAD
      Pay     **********428,684.44************************************* CANADIAN D
      To The  MERIDIAN CREDIT UNION
      Order   STE 160 S
      Of      483 BAY ST
              TORONTO ON M5G 2E1                 ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      HEPCOEDRUN   12                1200175687   16/05/07
      Payee
      MERIDIAN CREDIT UNION
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 MERIDIEN02MAY07                          0.00 CAD       428,684.44
                                                                                    Check No.   Date      Payment Amt
                                     1200175688  16/05/07         7,319.15  CAD
      Pay     SEVEN THOUSAND THREE HUNDRED NINETEEN & 15/100************* CANADIAN D
      To The  HYDRO ONE EMPLOYEES AND
      Order   PENSIONERS CHARITY TRUST
      Of      483 BAY STREET 14TH FL
              NORTH TOWER                        ______________________________
              TORONTO ON M5G 2P5
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      HYDROONEEP                     1200175688   16/05/07
      Payee
      HYDRO ONE EMPLOYEES AND
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 CHARITY02MAY07                           0.00 CAD         7,319.15
                                                                                    Check No.   Date      Payment Amt
                                     1200175689  16/05/07           357.97  CAD
      Pay     THREE HUNDRED FIFTY SEVEN & 97/100************************* CANADIAN D
      To The  MINISTER OF FINANCE
      Order   KENORA SMALL CLAIMS COURT
      Of      216 WATER STREET
              KENORA ON P9N 1S4                  ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      KENORASMCC                     1200175689   16/05/07
      Payee
      MINISTER OF FINANCE
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 KENORASMCC09MAY                          0.00 CAD           357.97
                                                                                    Check No.   Date      Payment Amt
                                     1200175690  16/05/07           692.41  CAD
      Pay     SIX HUNDRED NINETY TWO & 41/100**************************** CANADIAN D
      To The  MURRAY, WALTER
      Order   .
      Of      1721 CEDAR LANE
              BRACEBRIDGE ON P1L 1W9             ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      MURRAYWALT                     1200175690   16/05/07
      Payee
      MURRAY, WALTER
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      09/05/07 EXS2007710                               0.00 CAD           692.41
                                                                                    Check No.   Date      Payment Amt
                                     1200175691  16/05/07         2,437.44  CAD
      Pay     TWO THOUSAND FOUR HUNDRED THIRTY SEVEN & 44/100************ CANADIAN D
      To The  PACE, ROBERT
      Order   .
      Of      5121 SACKVILLE ST, 7TH FLOOR
              HALIFAX NS B3J 1K1                 ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      PACEROBERT                     1200175691   16/05/07
      Payee
      PACE, ROBERT
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      09/05/07 EXS200711                                0.00 CAD         2,437.44
                                                                                    Check No.   Date      Payment Amt
                                     1200175692  16/05/07         2,718.35  CAD
      Pay     TWO THOUSAND SEVEN HUNDRED EIGHTEEN & 35/100*************** CANADIAN D
      To The  RECEIVER GENERAL FOR CANADA
      Order   CANADA CUSTOMS REVENUE AGENCY
      Of      875 HERON RD
              OTTAWA ON K1A 1B1                  ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      RECEIVEGEN                     1200175692   16/05/07
      Payee
      RECEIVER GENERAL FOR CANADA
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 CRABNW02MAY07                            0.00 CAD         2,718.35
                                                                                    Check No.   Date      Payment Amt
                                     1200175693  16/05/07         7,688.00  CAD
      Pay     SEVEN THOUSAND SIX HUNDRED EIGHTY EIGHT & 00/100*********** CANADIAN D
      To The  RECEIVER GENERAL FOR CANADA
      Order   INDIAN & NORTHERN AFFAIRS
      Of      100 ANEMKI DRIVE
              RR #4                              ______________________________
              THUNDER BAY ON P7J 1A5
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      RECEIVGECA   77                1200175693   16/05/07
      Payee
      RECEIVER GENERAL FOR CANADA
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      14/05/07 P2107132007                              0.00 CAD         7,688.00
                                                                                    Check No.   Date      Payment Amt
                                     1200175694  16/05/07         4,155.20  CAD
      Pay     FOUR THOUSAND ONE HUNDRED FIFTY FIVE & 20/100************** CANADIAN D
      To The  REUTERS CANADA LIMITED
      Order   CANADA
      Of      PO BOX 1519, STATION A
              TORONTO ON M5W 3N9                 ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      REUTERINSV                     1200175694   16/05/07
      Payee
      REUTERS CANADA LIMITED
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      01/04/07 ICA807040667                             0.00 CAD         4,155.20
                                                                                    Check No.   Date      Payment Amt
                                     1200175695  16/05/07         4,155.20  CAD
      Pay     FOUR THOUSAND ONE HUNDRED FIFTY FIVE & 20/100************** CANADIAN D
      To The  REUTERS CANADA LIMITED
      Order   CANADA
      Of      PO BOX 1519, STATION A
              TORONTO ON M5W 3N9                 ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      REUTERINSV                     1200175695   16/05/07
      Payee
      REUTERS CANADA LIMITED
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      01/05/07 ICA807050645                             0.00 CAD         4,155.20
                                                                                    Check No.   Date      Payment Amt
                                     1200175696  16/05/07        10,000.00  CAD
      Pay     TEN THOUSAND & 00/100************************************** CANADIAN D
      To The  WATERLOO REGIONAL CHILDRENS
      Order   MUSEUM
      Of      10 KING ST W
              KITCHENER ON N2G 1A3               ______________________________
                                                         Authorized Signature
      Vendor ID        Personnel ID  Check No.    Date
      WATERLRECM                     1200175696   16/05/07
      Payee
      WATERLOO REGIONAL CHILDRENS
        Date     Invoice No.   PO/Cntrct Rel  Discount/Wthld Cur  Payment Amount
      29/11/06 2006050034                               0.00 CAD        10,000.00

    Raj:
    You could create a 'Before Header' page process to create this 'flat file'. The code for the page process will be something similar to declare
    v_file_name   VARCHAR2 (2000) := 'fixedFieldsFile.txt';
    --- Client Record Format
    f1 char(20);
    f2 char(20);
    f3 char(20);
    ---- End format
    begin
    OWA_UTIL.mime_header ('application/txt', FALSE);
    htp.p('Content-Disposition:attachment;filename="'|| v_file_name|| '"');
    OWA_UTIL.http_header_close;
    for c1 in (select * from emp) loop                           ----- The report query
    f1:= c1.empno;f2:=c1.ename;f3:=c1.sal;
    htp.p(f1||f2||f3);
    end loop;
    apex_application.g_unrecoverable_error:=true;
    exception when others then
    null;
    end; Varad

  • Error Loading Data into a flat file

    I am recieving the following error when loading data into a flat file from a flat file. SQL 2005 is my back end DB. If I cut the file iin half approx 500K rows my ODI interface works fine. Not sure what to look at.. I rebuit the interface which before was just dying giving no error and now I am getting this.
    Thanks
    java.lang.Exception
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)

    Figured it out, found similar post that stated changing the HEAP size
    Increase the page size in odiparams.bat in the bin folder and restart Designer.
    For eg:
    set ODI_INIT_HEAP=128m
    set ODI_MAX_HEAP=1024m

  • How to generate blank spaces at end of the record in a flat file with fixed

    Hi,
    I am generating a flat file with fixed length.
    In my ABAP program, i am able to see the spaces at the end of the recors in debug but when download to applicaiton server i am not able to see those spaces.
    How can i generate blank spaces at the end of the record in a flat file?
    Please update
    Thank you

    How are you downloading the file?  And, How are you looking at the file on the application server?
    Can you provide snippets of your code?
    Cheers
    John

  • TCODE TO DOWNLOAD IDOC INTO A FLAT FILE

    Hi All,
       Please let me know if there is any tcode to download IDOC into a flat file..
    Regards,
    Kaveri

    try with we60 where you should have links to download the idoc type.
    Please check this:
    1. How to Download a Hierarchy to a Flat File
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb
    2. How To Convert an IDoc-XML structure to a flat file and vice versa in XI 3.0 Version 1.10
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
    run the report RSEOUT00 with the idoc number, flat xml file will be generated at the location user/sap/XI/SYS/global/idoc_file
    Please rewrds if found help ful

  • Extracting data into different flat files

    I am using oracle 10g.
    I've to run a very complex query that will extract/spool around 300 million records. It is so expensive to run the query multiple times. I want to run the query once but spool all the jobs into chunks of different files
    so for 300 million records, I want to split the records into 10 different files of 30 million records each. Is it possible to do so??
    Thanks

    Hello,
    Technically it doesn't make any sense and make it poor solution over spooling a file and then splitting. But if O/P comes back and says table is partitioned, now I can use 2 different solution (utl_file or spooling using sqlplus). I will then rely on shell script which will lauch query based on partition and spool a file, once done it close the file and opens a new one for next partition and so on.
    Regards.

  • Splitting of a CSV File with Multiple Records into Multiple XML File

    Dear All,
    <b> I am doing a Scenario of CSV to XML Files. I am using BPM for the same. My incoming CSV File has got multiple records. I want to break this Multiple records into Multiple XML Files having one record each.</b>
    Can someone suggest how can I break this rather Split this into Multiple XML Files.
    Is Multimapping absoltely necesaary for this. Can't we do this without Multimapping. Can we have some workaround in the FCC parameters that we use in the Integration Directory.
    Kindly reply ASAP. Thanks a lot to all in anticipation.
    Pls Help.
    Best Regards
    Chakra and Somnath

    Dear All,
    I am trying to do the Multimapping, and have 0....unbounded also. Someways it is not working.
    <b>
    Smitha please tell me one thing...Assigning the Recordsets per Message to 1, does it mean that it will write multiple XML Files as I want.</b>
    Also I am usinf Set to Read only. So once the File is read it becomes RA from A. Then will it write the other Records.
    I have to use a BPM because there are certain dependencies that are there for the entire Process Flow. I cannot do without a BPM.
    Awaiting a reply. Thanks a lot in anticipation.
    Best Regards
    Chakra and Somnath

  • Export data to a flat file

    Hi all,
    I need to export a table data to a flat file.
    But the problem is that the data is huge about 200million rows occupying around 60GB of space
    If I use SQL*Loader in Toad, it is taking huge time to export
    After few months, I need to import the same data again into the table
    So please help me which is the efficient and less time taking method to do this
    I am very new to this field.
    Can some one help me with this?
    My oracle database version is 10.2
    Thanks in advance

    OK so first of all I would ask the following questions:
    1. Why must you export the data and then re-import it a few months later?
    2. Have you read through the documentation for SQLLDR thoroughly ? I know it is like stereo instructions but it has valuable information that will help you.
    3. Does the table the data is being re-imported into have anything attached to it eg: triggers, indices or anything that the DB must do on each record? If so then re-read the the sqlldr documentation as you can turn all of that off during the import and re-index, etc. at your leisure.
    I ask these questions because:
    1. I would find a way for whatever happens to this data to be accomplished while it was in the DB.
    2. Pumping data over the wire is going to be slow when you are talking about that kind of volume.
    3. If you insist that the data must be dumped, massaged, and re-imported do it on the DB server. Disk IO is an order of magnitude faster then over the wire transfer.

Maybe you are looking for