Solved

How do I maintain an auto increment identity column with direct path loads?

Posted on 2008-10-08
4
384 Views
Last Modified: 2013-12-18
Hi Experts,
I have a very large flat text file.  I will be loading this file into an oracle database using direct path loading with committs happening every 1,000,000 rows.  I would like to maintain an autoincrementing identity column for each row that is imported.  This is easy to do with conventional path loading with setting up a sequence and an trigger on inserts.  How can this be done with direct path loads?
0
Comment
Question by:GIFT22075
[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
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Shaju Kumbalath earned 500 total points
ID: 22668945
eg:

LOAD DATA
INFILE 'xyz.dat'
BADFILE 'xyz.bad'
LOG xyz.log
INSERT INTO TABLE empmast
(emp_no POSITION(1:6) INTEGER,
emp_name POSITION(7:31) CHAR,
seq_no SEQUENCE(MAX,1))

0
 
LVL 15

Expert Comment

by:Shaju Kumbalath
ID: 22668953
where seq_no is auto incremented
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 22669319
or use RECNUM if you simply need a 1..N count

LOAD DATA
INFILE 'xyz.dat'
BADFILE 'xyz.bad'
LOG xyz.log
INSERT INTO TABLE empmast
(emp_no POSITION(1:6) INTEGER,
emp_name POSITION(7:31) CHAR,
seq_no recnum)



0
 

Author Comment

by:GIFT22075
ID: 22669368
thanks you guys i'm testing out the solutions now and will post feedback
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
best datatype for oracle table email creation 8 104
Row_number in SQL 6 56
Age Calculation from specific date 19 58
replicate in oracle 13 45
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.
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.
This video shows how to recover a database from a user managed backup
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

734 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