Details
Description
Test case:
DROP PROCEDURE IF EXISTS test;
|
|
DELIMITER ;;
|
|
CREATE PROCEDURE test()
|
BEGIN
|
DECLARE i INT UNSIGNED DEFAULT 10;
|
DECLARE d DECIMAL(2,1) UNSIGNED DEFAULT 1.5;
|
|
SELECT JSON_OBJECT('int_variable', i, 'int_literal', 20, 'decimal_variable', d, 'decimal_literal', 2.6 );
|
|
END;;
|
|
DELIMITER ;
|
CALL test;
|
Returns:
+---------------------------------------------------------------------------------------------------+
|
| JSON_OBJECT('int_variable', i, 'int_literal', 20, 'decimal_variable', d, 'decimal_literal', 2.6 ) |
|
+---------------------------------------------------------------------------------------------------+
|
| {"int_variable": "10", "int_literal": 20, "decimal_variable": "1.5", "decimal_literal": 2.6} |
|
+---------------------------------------------------------------------------------------------------+
|