• 2022-06-16
    用存储过程求1+2+3+4+...+100之和。用SQL语句实现如下: DELIMITER $$ CREATE PROCEDURE proc_sum100() BEGIN (1) i, SUM INT DEFAULT 0; SIGN: (2) IF i >100 THEN SELECT i, SUM; (3) SIGN; (4) SET SUM = SUM + i; SET (5) ; (6) ; (7) SIGN; END $$ DELIMITER ; #调用存储过程 (8) ;