x
login about faq Site discussion (meta-askssc)

Can we skip certain columns while loading data ?

Can anybody explain to me how to skip certain columns of rows/records while loading data ? Thank you in advance.

more ▼

asked Jan 21 '10 at 12:08 PM in Default

OracleApprender gravatar image

OracleApprender
763 53 67 73

How are you loading data? Are those columns NULLable? If so, just omit that column in your load, whether that be INSERT or SQL*Loader.

Jan 21 '10 at 12:17 PM HillbillyToad

We are loading the data from a file to a database. Columns may have data or NULL.

Jan 22 '10 at 12:28 PM OracleApprender

What is your load mechanism though? Running insert statements, using SQL*Loader, IMPORT, DataPump, 3rd party tool like Toad, what?

Jan 24 '10 at 01:39 PM HillbillyToad

Direct Load mechanism. Running Insert statement is conventional mechanism.

Jan 25 '10 at 09:09 AM OracleApprender
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

One cannot use POSTION(x:y) with delimited data. Luckily, from Oracle 8i one can specify FILLER columns. FILLER columns are used to skip columns/fields in the load file, ignoring fields that one does not want.

Look at this example: -- One cannot use POSTION(x:y) as it is stream data, there are no positional fields-the next field begins after some delimiter, not in column X. -->

LOAD DATA TRUNCATE INTO TABLE T1 FIELDS TERMINATED BY ',' ( field1, field2 FILLER, field3 )

more ▼

answered Jan 25 '10 at 09:15 AM

OracleApprender gravatar image

OracleApprender
763 53 67 73

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x360
x321
x210
x50

asked: Jan 21 '10 at 12:08 PM

Seen: 876 times

Last Updated: Jan 22 '10 at 06:29 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.