I have a table that i i created an SP to insert data into it.
When i run the SP i get the error in the subject, if i run a manual insert with the same data this works as expected.
Manual insert works
INSERT INTO Leagues (LeagueName, PlatformID, GameID, ActiveStatus, Admin, PointsSys)
VALUES ('LeagueName', 1, 1, 'Active', 'Test', 1);
Calling SP does not - Returns error 'ERROR 1048 (23000): Column \'LeagueName\' cannot be null'
CALL `tmddg-data`.`SP_CreateLeague`('LeagueName', 1, 1, 'Active', 'Test', 1)
Create Table
CREATE TABLE `Leagues` (
`LeagueID` int(11) NOT NULL AUTO_INCREMENT,
`LeagueName` text NOT NULL,
`PlatformID` int(11) NOT NULL,
`GameID` int(11) NOT NULL,
`ActiveStatus` text NOT NULL,
`Admin` varchar(45) NOT NULL,
`PointsSys` int(11) DEFAULT '1',
PRIMARY KEY (`LeagueID`),
UNIQUE KEY `LeagueID_UNIQUE` (`LeagueID`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
Create SP
DELIMITER $$
CREATE PROCEDURE `SP_CreateLeague`(
LN TEXT,
PID INT,
GID INT,
ASt TEXT,
ADM VARCHAR(45),
PS INT)
BEGIN
DECLARE exit handler for SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
@errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
SELECT @full_error;
END;
INSERT INTO Leagues (LeagueName, PlatformID, GameID, ActiveStatus, Admin, PointsSys)
VALUES ( @LN, @PID, @GID, @ASt, @ADM, @PS);
END$$
DELIMITER ;