sql - HOWTO Make a Function With Loop/Repeat In MySQL? -
i'm trying rid of boring task of clicking on create button of gui creating new rows i've decided define function many times want to... here's code, returns error in navicat:
create function addrow (number int) begin set @x = 0; repeat insert 'result' () values () set @x += 1; until x > @number end repeat; end call addrow (10)
error:
[sql]create function addrow (number int) begin set @x = 0; repeat insert 'result' () values () set @x += 1; until x > @number end repeat; end call addrow (10) [err] 1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'begin set @x = 0; repeat insert 'result' () values () set @x += ' @ line 2
Comments
Post a Comment