"paqogomez" <[EMAIL PROTECTED]> wrote:
> I am trying to build a stored procedure in v. 5.
> This is what I have so far.
> 
> delimiter |
> create procedure get_id(out oid int)
> begin
>    insert into mercury.merchant (name) values(null);
>    select last_insert_id() into @mid;
>    insert into mercury.customers( address1 ) values (null);
>    select last_insert_id() into @cid;
>    insert into mercury.item_information( description ) values (null);
>    select last_insert_id() into @iiid;
>    insert into mercury.fee_information ( delivery_fee ) values (null);
>    select last_insert_id() into @fiid;
>    insert into mercury.orders ( customer_id, merchant_id,
> item_information_id, fee_information_id ) values ( @cid, @mid, @iiid,
> @fiid );
>    select last_insert_id() into oid;
> end
> |
> 
> My problem is that last_insert_id() is not updated for each insert
> statement, only on the connection.  The documentation says something about
> using insert ignore, but I couldnt get this to give me any different
> results.
> 
> Is there any way to do what I want here and still have the procedure be
> transaction safe?
> 

This issue is related to the known bug. It's already fixed:
        http://bugs.mysql.com/bug.php?id=3117


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to