有时候需要做DB的效率测试时,需要模拟大量数据。可以根据一条原始数据,通过执行存储过程拷贝出大量数据:
CREATE OR REPLACE PROCEDURE proc_msw_strsql IS i INT; BEGIN i :=1; WHILE i<=100000 LOOP INSERT INTO REP_DATAF_07_0 (SELECT REP_DATAF_07_ITEMID_SEQ.nextval AS PKID, ORGAN_ID, REPORT_ID, ITEM_ID, REPORT_DATE, CREATE_DATE, ITEMVALUE1, ITEMVALUE2, ITEMVALUE3, ITEMVALUE4, ITEMVALUE5, ITEMVALUE6, ITEMVALUE7, ITEMVALUE8, ITEMVALUE9, ITEMVALUE10, ITEMVALUE11, ITEMVALUE12, ITEMVALUE13, ITEMVALUE14, ITEMVALUE15, ITEMVALUE16, ITEMVALUE17, ITEMVALUE18, ITEMVALUE19, ITEMVALUE20, ITEMVALUE21, ITEMVALUE22, ITEMVALUE23, ITEMVALUE24, ITEMVALUE25, ITEMVALUE26, ITEMVALUE27, ITEMVALUE28, ITEMVALUE29, ITEMVALUE30, ITEMVALUE31, ITEMVALUE32, ITEMVALUE33, ITEMVALUE34, ITEMVALUE35, ITEMVALUE36, ITEMVALUE37, ITEMVALUE38, ITEMVALUE39, ITEMVALUE40, ITEMVALUE41, ITEMVALUE42, ITEMVALUE43, ITEMVALUE44, ITEMVALUE45, ITEMVALUE46, ITEMVALUE47, ITEMVALUE48, ITEMVALUE49, ITEMVALUE50, ITEMVALUE51, ITEMVALUE52, ITEMVALUE53, ITEMVALUE54, ITEMVALUE55, ITEMVALUE56, ITEMVALUE57, ITEMVALUE58, ITEMVALUE59, ITEMVALUE60, ITEMVALUE61, ITEMVALUE62, ITEMVALUE63, ITEMVALUE64, ITEMVALUE65, ITEMVALUE66, ITEMVALUE67, ITEMVALUE68, ITEMVALUE69, ITEMVALUE70, ITEMVALUE71, ITEMVALUE72, ITEMVALUE73, ITEMVALUE74, ITEMVALUE75, ITEMVALUE76, ITEMVALUE77, ITEMVALUE78, ITEMVALUE79, ITEMVALUE80, ITEMVALUE81, ITEMVALUE82, ITEMVALUE83, ITEMVALUE84, ITEMVALUE85, ITEMVALUE86, ITEMVALUE87, ITEMVALUE88, ITEMVALUE89, ITEMVALUE90, ITEMVALUE91, ITEMVALUE92, ITEMVALUE93, ITEMVALUE94, ITEMVALUE95, ITEMVALUE96, ITEMVALUE97, ITEMVALUE98, ITEMVALUE99, ITEMVALUE100, ITEMVALUE101, ITEMVALUE102, ITEMVALUE103, ITEMVALUE104, ITEMVALUE105, ITEMVALUE106, ITEMVALUE107, ITEMVALUE108, ITEMVALUE109, ITEMVALUE110, ITEMVALUE111, ITEMVALUE112, ITEMVALUE113, ITEMVALUE114, ITEMVALUE115, ITEMVALUE116, ITEMVALUE117, ITEMVALUE118, ITEMVALUE119, ITEMVALUE120, ITEMVALUE121, ITEMVALUE122, ITEMVALUE123, ITEMVALUE124, ITEMVALUE125, ITEMVALUE126, ITEMVALUE127, ITEMVALUE128, ITEMVALUE129, ITEMVALUE130, ITEMVALUE131, ITEMVALUE132, ITEMVALUE133, ITEMVALUE134, ITEMVALUE135, ITEMVALUE136, ITEMVALUE137, ITEMVALUE138, ITEMVALUE139, ITEMVALUE140 FROM REP_DATAF_07_0 WHERE PKID=‘332‘ ); i :=i +1; END LOOP; COMMIT; END;
写好存储过程之后,编译一下。然后执行调用存储过程的代码:
begin proc_msw_strsql; end;
时间: 2024-10-17 21:19:01