Insert across 2 tables - newbie help!

Insert across 2 tables - newbie help!

Post by Steven » Tue, 26 Jun 2001 02:36:00



Please help, there must be a simple solution to this, but I can't find it!

I'm trying to do an insert across 2 tables that have a primary key/foreign
key relationship. I want to use a stored procedure. I'm figuring that
nesting one stored procedure inside another would be a good idea, the first
could insert into the primary table and return the primary key as an Output
value, but I can't even find how to this.

Please help!

Steven

 
 
 

Insert across 2 tables - newbie help!

Post by Steven » Wed, 27 Jun 2001 02:29:30


Thanks - and point taken about the double posting

Steven


Quote:> Please help, there must be a simple solution to this, but I can't find it!

> I'm trying to do an insert across 2 tables that have a primary key/foreign
> key relationship. I want to use a stored procedure. I'm figuring that
> nesting one stored procedure inside another would be a good idea, the
first
> could insert into the primary table and return the primary key as an
Output
> value, but I can't even find how to this.

> Please help!

> Steven


 
 
 

Insert across 2 tables - newbie help!

Post by Hans van Strat » Tue, 26 Jun 2001 21:07:44


Steven,

Do you know the primary key at the moment you insert the record or
does it gets generated during the insert action?

When you know it beforehand, you don't need the output. When it gets
generated you have to query the database for the generated field and
return it.

Output parameters for a stored procedure are preceded with the
reserved word 'output'.

Regards, Hans


> Please help, there must be a simple solution to this, but I can't find it!

> I'm trying to do an insert across 2 tables that have a primary key/foreign
> key relationship. I want to use a stored procedure. I'm figuring that
> nesting one stored procedure inside another would be a good idea, the first
> could insert into the primary table and return the primary key as an Output
> value, but I can't even find how to this.

> Please help!

> Steven

 
 
 

1. Insert across 2 tables - newbie help!

Please help, there must be a simple solution to this, but I can't find it!

I'm trying to do an insert across 2 tables that have a primary key/foreign
key relationship. I want to use a stored procedure. I'm figuring that
nesting one stored procedure inside another would be a good idea, the first
could insert into the primary table and return the primary key as an Output
value, but I can't even find how to this.

Please help!

Steven

2. transferring Kanji data from Excel 2000 to Oracle8.1.6.3.0

3. Insert across 2 tables - please help newbie!

4. obtaining timestamp from server

5. Newbie: Need Help in sharing common data tables across schemas

6. ADO Parameter type

7. Newbie: SUM across tables

8. updating recordset returned by parameterized stored procedure

9. Newbie! Deleting Records across Tables

10. inserting table data across servers using t-sql

11. inserting table rows across servers using t-sql

12. (Newbie)Inserting rows from one table to another table