1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| create or replace procedure sptDatePro ( v_spt_date_st in test02.spt_date%TYPE, v_spt_date_ed in test02.spt_date%TYPE, v_spt_date out test02.spt_date%TYPE, v_code1 in out test02.code1%TYPE, v_code2 in out test02.code2%TYPE, v_code3 in out test02.code3%TYPE, v_num out test02.num%TYPE ) is declare v_currdate date; v_ymd date; v_endymd date; begin
v_ymd := to_date(v_spt_date_st, 'YYYYMMDD'); v_endymd := to_date(v_spt_date_ed, 'YYYYMMDD');
print v_ymd; print v_endymd;
while v_ymd <= v_endymd insert into test02 ( spt_date , code1 , code2 , code3 , num ) select v_ymd , v_code1 , v_code2 , v_code3 , int(rand()*100) from sysibm.dual ; set v_ymd = v_ymd + 1; end loop; commit; end sptDatePro;
select * from test02;
|