Awk and sql field comparation help.

Hi, before my question let me excuse myself for the bad grammar and possible confusion (i am used to write in spanish)*

I need some help, i'm making a query:

SELECT empnmbr as empl, origin as addr, old_fields_value as prev_sta, new_fields_value as new_sta \
FROM webapplog$bdate, datachangelog$bdate \
WHERE datachangelog$bdate.webapplog_oid = webapplog$bdate.oid \
AND datachangelog$bdate.table_name = 'address'
ORDER BY WEBAPPLOG_OID

which returns answers like:

empl | addr | prev_sta | new_sta
23424|3030303| 17,1,2,3,4,5,6,7,8|17,2,2,3,4,5,6,7,9
12345|home ad| 18,1,5,1,6,1,16,15|18,2,4,1,6,1,16,19

What i need is to read every line of the answer, compare the differences between the third and fourth fields for every line, and mark in which position of those fields are the differences.

so the answer will be more like:

empl | addr | prev_sta | new_sta | position
23424|3030303| 1 |2 | 2
23424|3030303| 8 |9 | 9
12345|home ad| 1 |2 | 2
12345|home ad| 5 |4 | 3
12345|home ad| 15 |19 | 8

but i have no idea what to do here. Maybe passing each field to an array and comparing arrays? the third and fourth fields of the original query have always the same number of elements (25) but sometimes only a single element is different.

Please any hint is helpful

*Si a alguno de los miembros del foro le parece mas simple puedo escribir en espanol y quiza sea mas claro el caso

awk -F'|' 'NR==1{print $0, "position"; next}
           {n=split($3,a,","); split($4,b,",")
           while(++i<=n) if(a!=b) print $1,$2,a,b,i
           i=split("",a); split("",b)}' OFS='|' filename

perl

sub comp{
	#print $_[0]," -- ",$_[1],"\n";
	my @a1=split(",",$_[0]);
	my @a2=split(",",$_[1]);
	my @arr;
	for(my $i=0;$i<=$#a1;$i++){
		push @arr, $a1[$i]."|".$a2[$i]."|".($i+1) if $a1[$i] != $a2[$i]
	}
	return \@arr;
}
open $fh,"<","a.spl" or die "Can not open file";
while(<$fh>){
	chomp;
	my @tmp=split("[|]",$_);
	if($tmp[2] ne $tmp[3]){
		my $ref=comp($tmp[2],$tmp[3]);
		map {print $tmp[0],"|",$tmp[1],"|",$_,"\n"} @$ref;
	}
}

awk

nawk -F"|" '{
	num=split($3,arr1,",")
	num=split($4,arr2,",")
	for(i=1;i<=num;i++){
		if(arr1!=arr2)
			print $1"|"$2"|"arr1"|"arr2"|"i
	}
}' filename

thanks to all, you've helped me a lot, i was able to make it work.