Solved

Loading Fields initiated by Piped delimited data into external table.

Posted on 2013-05-21
1
436 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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dataware house query tuning 9 81
sql query 9 46
Oracle 10g standard edition server with 4 processors 3 55
oracle- set role and grant privileges 6 29
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

822 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