Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MASS INSERT INTO

Status
Not open for further replies.

LaurenM

Programmer
Jun 5, 2006
62
CA
I have a table that I'm trying to do a mass insert into, but one of the fields that comprises the primary key is also a foreign key, which is also a sequential number that is generated by the other table, doesn't get updated after the first record is inserted. Is there any way to keep generating the next valid sequential number while doing the mass insert? I'm thinking of either using a trigger or a function, but I'm not totally sure.

Thanks in advance,
Lauren

Lauren McDonald, B.Sc.
Programmer Analyst
Saskatchewan Healthcare Employees' Pension Plan

 

Normally you would use a trigger, but it is not clear what your requirements are. [ponder]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
There is this table in the db with a four part primary key, one of them is a foreign key to another table, which is alos a sequential number, normally when I do single insert into this table I use the following command to generate the senquential number: select v3detailkey_seq.nextval into :new.v3detailkey from dual. But when I do a mass insert that sequential number is only generated once, when I need it to be regenerated with each record that is inserted.

Lauren McDonald, B.Sc.
Programmer Analyst
Saskatchewan Healthcare Employees' Pension Plan

 
Lauren,

What table are you using to drive your "mass insert"? Can you post an abbreviated sample of the INSERT...SELECT statement that you are using?

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I can provide you with low-cost, remote Database Administration services: see our website and contact me via www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top