Hello,
I need to do a select from database and know the number of register founded.
I've the following UDF:
String Query = " ";
Channel channel = null;
DataBaseAccessor accessor = null;
DataBaseResult resultSet = null;
String ret = "0";
// Build the Query String
Query = "Select * from SAP_INTERF_PROYECTOS where NUMDOC = '" + BELNR + "' and POSDOC = '" + POSEX +"'";
try{
//Determine a channel, as created in the Configuration
channel = LookupService.getChannel("bs_arteche_tp_db_jdbc","cc_lookup_receiver");
//Get a system accessor for the channel. As the call is being made to an DB, an DatabaseAccessor is obtained.
accessor = LookupService.getDataBaseAccessor(channel);
//Execute Query and get the values in resultset
resultSet = accessor.executeQuery(Query);
}
//for(Iterator rows = resultSet.getRows();rows.hasNext();){
//ret = "1";
//}
catch(Exception ex){
}
finally
{
try
{
if (accessor != null)
ret = "1";
}
catch (Exception ex)
{
}
}
return ret;
The statment 'for' doesn't work, because it stays in an infinite loop.
The statment 'if' always return the same value, does not mind if exist register in the database
How can i verify if the database return register or not?
Thanks very much,
Regards,