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?

TIA
Chad

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

Reply via email to