Solved

Loading Fields initiated by Piped delimited data into external table.

Posted on 2013-05-21
1
433 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 76

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Oracle Database creation fails 5 38
Parametric query in oracle 6 42
automatic email alert 1 22
Oracle Next Available Number 2 20
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now