0

I am not at all familiar with Oracle so bear with me!

I am using version Oracle 10G with the web front end called Enterprise Manager. I have been given some CSV files to import however when I use the Load Data from User Files option I think I can set everything up but when the job runs it complains that there are unique constraints, I guess because there is duplicate data trying to be inserted.

How can I get the insert to create a new primary key similar to a MSSQL auto inc number?

Jon
  • 38,814
  • 81
  • 233
  • 382

2 Answers2

0

There is no autoinc type in Oracle. You have to use a sequence.
By using a before insert trigger, you could get something similar to what you get by using an autoinc in SQL Server.

You can see here how to do it.

Marius Burz
  • 4,555
  • 2
  • 18
  • 28
0

Oracle does not have an analog to the MSSQL auto incrementing field. The feature has to be simulated via triggers and Oracle sequences. Some options here are to:

  1. create a trigger to populate the columns you want auto incremented from a sequence
  2. delete the offending duplicate keys in the table
  3. change the values in your CSV file.

You might look at this related SO question.

Community
  • 1
  • 1
DCookie
  • 42,630
  • 11
  • 83
  • 92