더미 데이터 생성을 위한 프로시져문
간단하게
truncate from ${table};
begin
for i in 1 .. 201 loop
insert into ${table}(id, email, ...)
values (id_seq.NEXTVAL, 'admin'||i||'@naver.com', ...);
end loop;
end;
drop sequence ${table}_no;
create sequence ${table}_id_seq
increment by 1
start with 1;
조금더 복잡하게
DROP PROCEDURE IF EXISTS loopInsert
CREATE PROCEDURE loopInsert()
BEGIN
DECLARE i INT DEFAULT 1;
WHILE i <= 500 DO
Insert into TABLE_NAME (ColumnA, ColumnB) VALUES(i, 컬럼 값);
SET i = i + 1;
END WHILE;
END
CALL loopInsert()