The following stored procedure contains local variables, local1 and local2, that are of JSON type with a maximum length of 100. The local1 variable is initialized using the NEW JSON constructor method.
CREATE PROCEDURE TestJSON_TDSP1 (IN id INTEGER, OUT outName VARCHAR(20)) BEGIN DECLARE local1 JSON(100) DEFAULT NEW JSON('{"name":"Cameron", "age":24}'); DECLARE local2 JSON(100); ; ... END;