0

In this code i got #1064 error at line 5. can somebody rewrite the code; Thank you

  CREATE FUNCTION thuva.CreateGroup(GroupName VARCHAR(50), GroupIcon TEXT, GroupDescription VARCHAR(130), GroupCreator INT)
  RETURNS int(11)
  DETERMINISTIC
BEGIN
  DECLARE groupID INT;
  INSERT INTO groups (name, icon, description) VALUES (GroupName, GroupIcon, GroupDescription);
  SET groupID = LAST_INSERT_ID();
  INSERT INTO group_members VALUES (groupID, GroupCreator);
  RETURN groupID;
END;
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786

1 Answers1

0

Try using this syntax

DECLARE variable_name datatype [ DEFAULT initial_value ]

since its a datatype you need to define size something like.

DECLARE groupID INT(11);