create or replace procedure auditingToPhysical
(startNo number,
endNo number,
length number,
tableName varchar2,
prefix varchar2)
as
i number :=startNo;
ii varchar2(100);
add number;
zero varchar2(100);
resNo varchar2(100);
sqlt varchar2(100);
begin
for j in i..endNo loop
ii := rtrim(cast(i as varchar2));
if LEN(ii) <> length then
add := length - LEN(ii);
for k in 0..add loop
zero := zero || '0';
end loop;
ii := zero || ii;
end if;
resNo := prefix || ii ;
sqlt := 'insert into' || tableName || '(phy_no,phy_no_qian,phy_no_hou,kw_code,i_date) values (''' || resNo || ''' ,''' || prefix || ''',''' || ii || ''',''' || tableName || ''' ,GETDATE())' ;
EXEC(sqlt);
end loop;
end;
(startNo number,
endNo number,
length number,
tableName varchar2,
prefix varchar2)
as
i number :=startNo;
ii varchar2(100);
add number;
zero varchar2(100);
resNo varchar2(100);
sqlt varchar2(100);
begin
for j in i..endNo loop
ii := rtrim(cast(i as varchar2));
if LEN(ii) <> length then
add := length - LEN(ii);
for k in 0..add loop
zero := zero || '0';
end loop;
ii := zero || ii;
end if;
resNo := prefix || ii ;
sqlt := 'insert into' || tableName || '(phy_no,phy_no_qian,phy_no_hou,kw_code,i_date) values (''' || resNo || ''' ,''' || prefix || ''',''' || ii || ''',''' || tableName || ''' ,GETDATE())' ;
EXEC(sqlt);
end loop;
end;