خرید بک لینک

Vote count: 0

I'm having some with registerusers stored procedure with error message and when I executed the result I got an error that says:' MySQL said: Documentation

declare checkfirstnamecount int; declare checklastn' at line 10'

Here's my stored procedure:

DELIMITER go
Create procedure registerusers(
  Out UserID tinyint(11),
 IN iFirstName varchar(30),
 IN iLastName varchar(30),
 IN iPassword varchar(30),
 IN iEmailAddress varchar(30),
 IN iSalt varchar(40),
 IN iRoleID varchar(1))
BEGIN
--declaring local variable
declare checkfirstnamecount int;
declare checklastnamecount int;
declare checkpasswordcount int;
delcare checksaltcount int;
declare checkroleidcount int;
declare checkemailcount int;

declare checkexistingemailaddress varchar(30);

--checking the email address for one count
select count(emailaddress) into checkemailcount
from users
where emailaddress = iEmailaddress;

--checking the password for one count
select count(Password) into checkpasswordcount
from users
where Password = iPassword;
--checking the email address for one count
select count(FirstName) into checkfirstnamecount
from users
where FirstName = iFirstName;
--checking the last name for one count
select count(LastName) into checklastnamecount
from users
where LastName = iLastName;
--checking the salt for one count
select count(salt) into checksaltcount
from users
where salt = iSalt;
--checking the roleid for one count
select count(RoleID) into checkroleidcount
from users
where RoleID = iRoleID;
--checking the email address for one count for if it exists
select emailaddress into checkexistingemailaddress
from users
where emailaddress = iEmailaddress;

--checking for firstname if the user forgot to fill out the first name
If(checkfirstnamecount!=1) then

SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Fill out the First Name ';
--checking for Lastname  if the user forgot to fill out the last name
Elseif(checklastnamecount!=1) then

SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Fill out the Last Name';

--check if the password is not fill out
Elseif(checkpasswordcount!=1) then

SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Fill out the password';
--check is the salt is not fill out 
Elseif(checksaltcount!=1) then

SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Salt is not found';
--check if the roleid is not fill out
Elseif(checkroleidcount!=1) then

SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'RoleID is not found';

Elseif(checkemailcount!=1) then

SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Fill out the email address';
--checking if the emailaddress already exists in the table
Elseif(iEmailaddress=checkexistingemailaddress ) then
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Email Address already exists';

Else

insert into users(

FirstName,
 LastName ,
 Password ,
 EmailAddress ,
 Salt ,
 RoleID 
 )
Values
(
FirstName,
 LastName ,
 Password ,
 EmailAddress ,
 Salt ,
 RoleID 
);
set UserID = last_insert_id();  
 end if;

End
go
DELIMITER ;

asked 59 secs ago

برچسب: mysql stored procedure error message,mysql stored procedure error codes,mysql stored procedure return error message,mysql stored procedure get error message,mysql stored procedure print error message, نویسنده: استخدام کار تاريخ: جمعه 5 شهريور 1395 ساعت: 5:13

صفحه بندی