String s1 = "update employee set wtKey = name || pno || id where id is not null"; String s2 = "update employee set wtKey = name # pno # id where id is not null"; String[] rs1 = s1.split("||"); for(int i = 0;i < rs1.length;i++){ System.out.println(rs1[i]); } String[] rs2 = s2.split("#"); for(int j = 0;j < rs2.length;j++){ System.out.println(rs2[j]); }