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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using same mySeq.nextVal to insert into two tables

Status
Not open for further replies.

FALCONSEYE

Programmer
Jul 30, 2004
1,158
US
I am trying insert a PK as a FK to another table. Inside my trigger, I have:

Code:
 tmpTHID number;
 select mySeq.nextval into tmpTHID from dual;

 insert into tbl1 ( tmpTHID, .... )

 insert into tbl2 (id, tmpTHID, ... )

when i change something on tbl2, i get a tbl1 primary key constraint violated error. what can i do?

thanks in advance,

 
FalconsEye said:
when i change something on tbl2
What, more precisely, do you mean by "when I change something"? May we see more of your actual code that involves code that exemplifies a "change"? (Seeing such will help us to better help you.)


Thanks,

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm or risk. The cost will be your freedoms and your liberty.”
 
I'm confused as to whether you are asking a question here or have already solved it. If the question is still live, there isn't enough information here to give a response. We'd need a bit more than a very small code fragment.

For Oracle-related work, contact me through Linked-In.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top