哈哈
if length(batcode)=20 then
sapbatch :=substr(batcode,2,1) || substr(batcode,11,1) || substr(batcode,5,2)||
CHR(to_number(substr(batcode,7,2)) + 64)
|| substr(batcode,9,2)+ substr(batcode,12,1) || substr(batcode,13,2);
elsif length(batcode)=19 then
sapbatch :=substr(batcode,2,1) || substr(batcode,11,1) || substr(batcode,5,2) ||
CHR(to_number(substr(batcode,7,2)) + 64)
|| substr(batcode,9,2)|| substr(batcode,12,1) ||substr(batcode,13,2);
elsif length(batcode) =18 then
sapbatch :=substr(batcode,2,1) || substr(batcode,11,1)||substr(batcode,5,2)||
CHR(to_number(substr(batcode,7,2)) + 64)
|| substr(batcode,9,2)|| substr(batcode,12,1) ||substr(batcode,13,2);
elsif length(batcode)=22 then
sapbatch :=substr(batcode,2,1) || substr(batcode,11,1)|| substr(batcode,5,2)||
CHR(to_number(substr(batcode,7,2)) + 64)
|| substr(batcode,9,2)+ substr(batcode,12,1) || substr(batcode,13,2);
elsif length(batcode)=21 then
sapbatch :=substr(batcode,2,1) || substr(batcode,11,1)|| substr(batcode,5,2)||
CHR(to_number(substr(batcode,7,2)) + 64)
|| substr(batcode,9,2)|| substr(batcode,12,1) ||substr(batcode,13,2);
else
sapbatch :=substr(batcode,2,1) || substr(batcode,11,1)|| substr(batcode,5,2)||
CHR(to_number(substr(batcode,7,2)) + 64)
|| substr(batcode,9,2)+ substr(batcode,13,1) +'01';
end if;