MySQL Forums
Forum List  »  Stored Procedures

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
Re: about getting the auto increment to work in stored procedure
318
August 19, 2016 11:48AM


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.