oracle 存储过程造数

BEGIN
  FOR i IN
1 .. {count_insert} LOOP
    INSERT INTO IKASTRIGGER.IKAS10B       (COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN5, COLUMN6, COLUMN7, COLUMN8, COLUMN9, COLUMN10)       VALUES(substr(sys_guid(),
0,9)||i, to_char(systimestamp, 'yyyy-mm-dd hh24:mi:ss.ff6'), i, i,substr(sys_guid(),0,9),substr(sys_guid(),0,9),substr(sys_guid(),0,9),substr(sys_guid(),0,9),substr(sys_guid(),0,9),substr(sys_guid(),0,9));     COMMIT;   END LOOP; END;
BEGIN
  FOR v_row IN (
select COLUMN1 from IKASTRIGGER.ALAMTEST1 sample(50) WHERE rownum <={count_update} and COLUMN3 is null) LOOP
  UPDATE IKASTRIGGER.ALAMTEST1     SET COLUMN3
= to_char(systimestamp, 'yyyy-mm-dd hh24:mi:ss.ff6'),     COLUMN4 = substr(sys_guid(),5,14)     WHERE COLUMN1 = v_row.COLUMN1;   COMMIT;  END LOOP; END;
BEGIN
  FOR v_row IN (select COLUMN1 from IKASTRIGGER.ALAMTEST1 sample(50)   WHERE rownum <={ount_delete})
  LOOP
    delete from IKASTRIGGER.ALAMTEST1
    WHERE COLUMN1 = v_row.COLUMN1;
  COMMIT;
  END LOOP;
 END;

 

注意,复制黏贴,大概率执行失败,换行符需要重新整理

posted @ 2024-07-19 15:09  AlamZ  阅读(13)  评论(0编辑  收藏  举报