Solved

Loading Fields initiated by Piped delimited data into external table.

Posted on 2013-05-21
1
437 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
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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
oracle 11g 23 107
Database Design Dilemma 6 58
Need SQL Query to Find Foreign-keys Without Indexed Columns 4 26
PL/SQl Expanding the WHERE statement in query 3 21
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
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 videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

820 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