oracle存储过程字符串补全lpad示例

create or replace procedure mytest is
i int;
t int;
temp int;
goodsnum varchar(15);
begin
    i := 1; --开始
    t := 1000; --总数
    temp = i + t;
    while i < temp
       loop
          goodsnum := concat('0012022',lpad(i,8,0));
          insert into table1 ... ;
          insert into table2 ... ;,
          i := i + 1;
       end loop;
       commit;
end;
goodsnum: 格式
001202200000001

001202200000002
001202200000003
001202200000004
001202200000005
...
001202200000123
 
posted @ 2022-04-27 15:57  雷雨客  阅读(106)  评论(0编辑  收藏  举报