MySQL Forums
Forum List  »  Stored Procedures

help with my stored procedure
Posted by: Eduardo Trujillo
Date: May 29, 2017 09:48PM

Hi everyone, i need build an stored procedure, the idea is insert an a table a username and password and get the Ai id from this table and insert this var in other table.
Well this is my code:
create procedure _testInsert (in username varchar(64), in pass varchar(64))
begin
declare idUser int;
insert into user (user,password) values (username,pass);
select max(u.id)as result from user as u;
set idUser = result;
insert into profile values('','',idUser);
end
When I execute the procedure, the first insert run ok and i get the result from the select in the screen, but the second insert it does not work.

I am new to this would appreciate any help, if I have done something wrong with respect to the forum I am very sorry.

First of all, Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
help with my stored procedure
1351
May 29, 2017 09:48PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.