记录一下PG数据库创建并执行存储过程批量插入数据的SQL: create or replace function addId() returns boolean AS $BODY$ declare ii integer; begin ii := 1; FOR ii IN 1..1000000 LOOP INSERT INTO test01 (id) VALUES (ii); end LOOP; return true; end; $BODY$ LANGUAGE plpgsql; select *…
--批量插入数据的sql语句 delimiter $$ DROP PROCEDURE IF EXISTS `test.sp_insert_batch` $$ CREATE DEFINER =`root`@`localhost` PROCEDURE `sp_insert_atch`(IN number INT) BEGIN DECLARE i INT ; ; #such ,, WHILE i <= number DO ) THEN *rand()),')'); ELSEIF MOD(i,) THE…
參考资料(pl/pgsql 官方文档): http://www.postgresql.org/docs/9.3/static/plpgsql.html create or replace function creatData2() returns boolean AS $BODY$ declare ii integer; begin II:=1; FOR ii IN 1..10000000 LOOP INSERT INTO ipm_model_history_data (res_model, r…