PFB我使用的代码:
ResultSet rs1_1 = stmt1_1.executeQuery("select dfd.document_id,dfd.country_id,dfi.folder_name from dossier_folder_documents dfd,dossier_folder_info dfi where dfd.fk_dossier_folder_id=dfi.pk_dossier_folder_id and dfd.is_core is null and dfd.action='N' and dfd.fk_dossier_basic_info_id in (select pk_dossier_id from dossier_basic_info where dossier_id= '"+vdlist.get(g)+"') and (dfd.document_id,dfi.folder_name) not in(select dfd.document_id,dfi.folder_name from dossier_folder_documents dfd,dossier_folder_info dfi where dfd.fk_dossier_folder_id=dfi.pk_dossier_folder_id and dfd.fk_dossier_basic_info_id in (select pk_dossier_id from dossier_basic_info where dossier_id= '"+sdlist.get(g)+"' and data_state='C'))");
ResultSet rs1_2 = stmt1_2.executeQuery("select dfd.document_id,dfd.country_id,dfi.folder_name from dossier_folder_documents dfd,dossier_folder_info dfi where dfd.fk_dossier_folder_id=dfi.pk_dossier_folder_id and dfd.action='N' and dfd.fk_dossier_basic_info_id in (select pk_dossier_id from dossier_basic_info where dossier_id='"+vdlist.get(g)+"') and (dfd.document_id,dfd.country_id,dfi.folder_name) not in (select dfd.document_id,dfd.country_id,dfi.folder_name from dossier_folder_documents dfd,dossier_folder_info dfi where dfd.fk_dossier_folder_id=dfi.pk_dossier_folder_id and dfd.fk_dossier_basic_info_id in (select pk_dossier_id from dossier_basic_info where dossier_id='"+sdlist.get(g)+"' and data_state='C'))");
ResultSet rs2_1 = stmt2_1.executeQuery("select dfd.document_id,dfd.country_id,dfi.folder_name from dossier_folder_documents dfd,dossier_folder_info dfi where dfd.fk_dossier_folder_id=dfi.pk_dossier_folder_id and dfd.is_core is null and dfd.action='O' and dfd.fk_dossier_basic_info_id in (select pk_dossier_id from dossier_basic_info where dossier_id = '"+vdlist.get(g)+"') and (dfd.document_id,dfi.folder_name) in (select dfd.document_id,dfi.folder_name from dossier_folder_documents dfd,dossier_folder_info dfi where dfd.fk_dossier_folder_id=dfi.pk_dossier_folder_id and dfd.fk_dossier_basic_info_id in (select pk_dossier_id from dossier_basic_info where dossier_id = '"+sdlist.get(g)+"' and data_state='C'))");
ResultSet rs2_2 = stmt2_2.executeQuery("select dfd.document_id,dfd.country_id,dfi.folder_name from dossier_folder_documents dfd,dossier_folder_info dfi where dfd.fk_dossier_folder_id=dfi.pk_dossier_folder_id and dfd.action='O' and dfd.fk_dossier_basic_info_id in (select pk_dossier_id from dossier_basic_info where dossier_id='"+vdlist.get(g)+"') and (dfd.document_id,dfd.country_id,dfi.folder_name) in (select dfd.document_id,dfd.country_id,dfi.folder_name from dossier_folder_documents dfd,dossier_folder_info dfi where dfd.fk_dossier_folder_id=dfi.pk_dossier_folder_id and dfd.fk_dossier_basic_info_id in (select pk_dossier_id from dossier_basic_info where dossier_id='"+sdlist.get(g)+"' and data_state='C'))");
ResultSetMetaData rsmd1 = rs1_1.getMetaData();
ResultSetMetaData rsmd2 = rs2_1.getMetaData();
String temp5 = new String();
for(int f=1;f<=rsmd1.getColumnCount();f++)
{
data3+=rsmd1.getColumnName(f)+"/ /";}
temp4=data3;
data3="";
while(rs1_1.next())
{
//System.out.println("In here...");
num2=g;
for(int x=1;x<=rsmd1.getColumnCount();x++)
{
temp5+=rs1_1.getString(x)+"/ /";
}
String data5 = new String();
data5=temp5;
sublist1.add(data5);
//System.out.println("New Null: "+data5);
temp5="";
//System.out.println(sublist);
errvdlist.add(vdlist.get(num2));
errsdlist.add(sdlist.get(num2));
//System.out.println("Validation Dossier ID for New Corruption: "+vdlist.get(num2));
//System.out.println("Submission Dossier ID for New Corruption: "+sdlist.get(num2));
}
while(rs1_2.next())
{
//System.out.println("In here...");
num2=g;
for(int x=1;x<=rsmd1.getColumnCount();x++)
{
temp5+=rs1_2.getString(x)+"/ /";
}
String data5 = new String();
data5=temp5;
sublist1.add(data5);
//System.out.println("New Not Null: "+data5);
temp5="";
//System.out.println(sublist);
errvdlist.add(vdlist.get(num2));
errsdlist.add(sdlist.get(num2));
//System.out.println("Validation Dossier ID for New Corruption: "+vdlist.get(num2));
//System.out.println("Submission Dossier ID for New Corruption: "+sdlist.get(num2));
}
while(rs2_1.next())
{
num2=g;
for(int x=1;x<=rsmd2.getColumnCount();x++)
{
temp6+=rs2_1.getString(x)+"/ /";
}
//String data6 = new String();
data6=temp6;
sublist2.add(data6);
System.out.println("Old Null: "+data6);
temp6="";
data6="";
//System.out.println(sublist);
errvdlist.add(vdlist.get(num2));
errsdlist.add(sdlist.get(num2));
//System.out.println("Validation Dossier ID for Old Corruption: "+vdlist.get(num2));
//System.out.println("Submission Dossier ID for Old Corruption: "+sdlist.get(num2));
}
while(rs2_2.next() )
{
num2=g;
for(int x=1;x<=rsmd2.getColumnCount();x++)
{
temp6+=rs2_2.getString(x)+"/ /";
}
//String data6 = new String();
data6=temp6;
sublist2.add(data6);
System.out.println("Old Not Null: "+data6);
temp6="";
//System.out.println(sublist);
errvdlist.add(vdlist.get(num2));
errsdlist.add(sdlist.get(num2));
//System.out.println("Validation Dossier ID for Old Corruption: "+vdlist.get(num2));
//System.out.println("Submission Dossier ID for Old Corruption: "+sdlist.get(num2));
}
}
为结果集rs2_1
指定的查询应该返回两行,但仅返回一行。所有其他查询返回多行,其他结果集工作正常。需要帮助,因为我无法想到其他任何原因。