Solved

Loading Fields initiated by Piped delimited data into external table.

Posted on 2013-05-21
1
439 Views
Last Modified: 2013-05-27
Q1. How to display fields in external table whose delimiter starts with |

Normally we have data where the field is terminated with |, here i have a field started with |

Oracle treats COL1 as second column and so on. The last column is not shown.

Q2. When i load data from external table into actual table, i want to filter the header and footer data, and load only the piped delimited data. How do i do that?
The problem here is that even the header is delimited and i want to filter it
**************

DROP TABLE mytable CASCADE CONSTRAINTS;

CREATE TABLE mytable
(
  col1           VARCHAR2(500 BYTE),
  col2           VARCHAR2(500 BYTE),
  col3           VARCHAR2(500 BYTE)
)
ORGANIZATION EXTERNAL
  (  TYPE ORACLE_LOADER
     DEFAULT DIRECTORY mydir
     ACCESS PARAMETERS
       ( RECORDS DELIMITED BY NEWLINE
        NODISCARDFILE
        NOLOGFILE
        FIELDS TERMINATED BY '|' -->In my case a field starts by |, and thus last record col3 is not displayed
        MISSING FIELD VALUES ARE NULL
            REJECT ROWS WITH ALL NULL FIELDS
        (
  col1,
  col2,
  col3
        )
          )
     LOCATION (EXT_DATA:'myfile.dl')
  )
REJECT LIMIT 0
NOPARALLEL
NOMONITORING;


*****
Data:
*****
START-OF-FILE
START-OF-HEADER
EXECUTION-DATE=2013-01-01-13.10.41.000152
FILE-DATE=Wed JAN 01 00:00:00 BST 2013
PROGRAM-NAME=ABC
FEED-NAME=MYFEED
CONSUMER=NA
END-OF-HEADER
START-OF-DATA
-->Fields are initiated by a delimiter
|COL1                          |COL2                           |COL3              
|A1180137                 |10003                    |2013-04-02
|A1100970                 |10003                    |2013-04-02
END-OF-DATA
START-OF-TRAILER
EXECUTION-DATE=2013-05-08-13.10.41.000250
FILE-DATE=Wed Apr 03 00:00:00 BST 2013
PROGRAM-NAME=GPS
FEED-NAME=SWAP_ADJUSTMENT
RECORD COUNT= 1125
END-OF-TRAILER
END-OF-FILE
0
Comment
Question by:gram77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 39184556
>>Q1. How to display fields in external table whose delimiter starts with |

Define a FILLER column.


>>Q2. When i load data from external table into actual table, i want to filter the header and footer data, and load only the piped delimited data. How do i do that?

Header rows can be handled with SKIP:
http://docs.oracle.com/cd/E11882_01/server.112/e22490/et_params.htm#SUTIL012

Skips the specified number of records in the data file before loading. SKIP can be specified only when nonparallel access is being made to the data.

What do you mean be footer data?  The sample you posted doesn't appear to have any.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
update using pipeline function 3 46
Oracle cursor lifecycle inside procedure. 2 39
Performance Issue in Oracle 3 45
Automate an Oracle update in Excel 7 69
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question