?
Solved

Loading Fields initiated by Piped delimited data into external table.

Posted on 2013-05-21
1
Medium Priority
?
442 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 2000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Suggested Courses

800 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