💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
**1. 语法** ```sql [label:] WHILE condition DO statements END WHILE [label] ``` **2. 演示** ```sql delimiter $ create function fun_add(count int(11)) returns int begin declare sum int default 0; while count > 0 do set sum = sum + 1; set count = count - 1; end while; return sum; end $ mysql> select fun_add(5) $ +------------+ | fun_add(5) | +------------+ | 5 | +------------+ ```