Solved

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

Posted on 2008-10-08
4
385 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

691 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