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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -