I have the MYSQL stored procedure defined as shown below:
DROP PROCEDURE IF EXISTS TEST_LOCATION;
CREATE PROCEDURE `TEST_LOCATION`()
BEGIN
DECLARE VCount tinyint(1) DEFAULT 1;
INSERT INTO my_counts_model (type,code,model_code,count)
VALUES ( 1,1,456,1)
ON DUPLICATE KEY UPDATE count = count + 1;
END;
The procedure updates the count if the type,code,model_code has the value in table, otherwise inserts a new record. I mean the key is on type,code,model_code.
I want to get whether it is a new insert or the count update for further operations. I am trying to check for the return value of the INSERT INTO, but couldn't find syntax or any solution.