Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i have a data with
id,name,state
1,john,oh
2,terry,ca
3,peater,pa
4,mat,tx
5,steven,oh
6,cathy,ca
7,peater,pa
8,mat,tx
9,tracy,ok
now i am trying to get
id,name,state,rowid
1,john,oh,1
2,terry,ca,1
3,peater,pa,1
4,mat,tx,2
5,steven,oh,2
6,cathy,ca,2
7,peater,pa,3
8,mat,tx,3
9,tracy,ok,3
here i am trying to insert a row id for every 3 rows ie for every three rows i need have same row id and then increment the number for next 3 rows.
can you suggest what exactly do i need to do here
if(input_row.id%3==1){
output_row.seq_id=Numeric.sequence("s2",1,1);
globalMap.put("last_seq_id",output_row.seq_id);
}else{
output_row.seq_id=(Integer)globalMap.get("last_seq_id");
}