Posted on 2009-11-07 13:15
leekiang 阅读(275)
评论(0) 编辑 收藏 所属分类:
oracle
CREATE OR REPLACE PROCEDURE p_test(ST_NUM IN NUMBER, /*起始数值*/
ED_NUM IN NUMBER /*结束数值*/) IS
BEGIN
declare
i number;
begin
/*循环插入*/
FOR i IN ST_NUM .. ED_NUM LOOP
INSERT INTO test_temp values (i, 'test');
END LOOP;
end;
commit;
/*异常处理*/
EXCEPTION
WHEN OTHERS THEN
rollback;
END;
在command window里执行call p_test(1,100);