Re: Passing unique id to another table

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Sat, 15 Apr 2000 09:20:14 +0800
Message-ID: <38F7C3CE.6E91_at_yahoo.com>


Rook wrote:
>
> I have 2 tables
>
> customers
> ----------------
> Cus_ID pk
> First_Name
> Last_Name
>
> customer_address
> -------------------------
> Addess
> Zip_Code
> Phone
> address_id
>
> The fields are populated by a gui created in visual basic and passed to the
> tables via stored procedures
> The cus_id is created via a sequence.
> My question is, how can I pass the cus_id created by the sequence to the
> address_id in customer_Address.
> These are not the complete tables I'm using, however I hope it's enough for an
> anwser.

Use the returning clause.

insert into table values (x,y,z)
return cust_id into some_variable;

Then use 'some_variable' for your next insert.

HTH

-- 
===========================================
Connor McDonald
http://www.oracledba.co.uk

We are born naked, wet and hungry...then things get worse
Received on Sat Apr 15 2000 - 03:20:14 CEST

Original text of this message