MySQL Forums :: Stored Procedures :: about getting the auto increment to work in stored procedure


Advanced Search

Re: about getting the auto increment to work in stored procedure
Posted by: Bob Smith ()
Date: August 19, 2016 11:48AM

I had no problem with this:

INSERT INTO users VALUES (null,'Jamie','Smith','oreo','jamie@gmail.com','34 young street' );
SELECT LAST_INSERT_ID();

it work but when dealing with stored procedure I've tried:

DELIMITER go
Create procedure addusers(
Out UserID int(11),
IN FirstName varchar(10),
IN LastName varchar(10),
IN Password varchar(10),
IN EmailAddress varchar(10),
IN HomeAddress varchar(20)
BEGIN
insert into users(

FirstName,
LastName ,
Password ,
EmailAddress,
HomeAddress
)
Values
(
FirstName,
LastName ,
Password ,
EmailAddress ,
HomeAddress
)
set @UserID = null;

End
go
DELIMITER ;

and using
call addusers(

'Jamie',
'Smith',
'oreo',
'jamie@gmail.com',
'34 young street',@UserID);
select @UserID;

I got an error that says:
#1318 - Incorrect number of arguments for PROCEDURE JonesCorp.addusers; expected 6, got 5"

I even tried:

call addusers(

'Jamie',
'Smith',
'oreo',
'jamie@gmail.com',
'34 young street');
select @UserID;

and I still got the same error that says: #1318 - Incorrect number of arguments for PROCEDURE JonesCorp.addusers; expected 6, got 5"

Options: ReplyQuote


Subject Views Written By Posted
about getting the auto increment to work in stored procedure 2521 Bob Smith 08/18/2016 02:40PM
Re: about getting the auto increment to work in stored procedure 321 Peter Brawley 08/18/2016 03:10PM
Re: about getting the auto increment to work in stored procedure 277 Bob Smith 08/19/2016 11:48AM
Re: about getting the auto increment to work in stored procedure 276 Peter Brawley 08/19/2016 12:26PM


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.