Stored Procedure problem
am 31.01.2007 07:42:51 von peterlohHi,
I'm trying to create a stored procedure using the following syntax,
but I'm getting an error.
CREATE PROCEDURE `site`.`sp_ValidateInvite_SEL` (invitecode
varchar(10))
BEGIN
-- Check that the code exists (deleted/blocked users' invites will be
deleted)
IF NOT EXISTS (SELECT * FROM `invitations` WHERE `InvitationCode` =
invitecode) THEN
SELECT 'Error' As `Status`, 'Invitation Code is invalid.'
As `Details`;
ELSE
SELECT 'Invited' As `Status`, 'blahblah' As `Details`;
END IF
END
Could someone tell me what the problem could be? Can you use the EXIST
function as a condition (or a parameter within a EXIST function/
subquery)?
I'm using MySQL Administrator which automatically add the delimiter
statement.
Regards,
Peter