cancel
Showing results for 
Search instead for 
Did you mean: 

for sentence in UDF locks the system

Former Member
0 Kudos

Hello,

I've a UDF in my interface (IDOC to JDBC), i need verify exits the data in table of database

The code is the follow:

String Query = " ";

Channel channel = null;

DataBaseAccessor accessor = null;

DataBaseResult resultSet = null;

String ret = "0";

Query = "Select * from MAESTRO where NUMDOC = '" + BELNR + "' and POSDOC = '" + POSEX +"'";

try{

channel = LookupService.getChannel("bs_jdbc","cc_lookup_receiver");

accessor = LookupService.getDataBaseAccessor(channel);

resultSet = accessor.execute(Query);

for(Iterator rows = resultSet.getRows();rows.hasNext();){

ret = "1";

}

}

catch(Exception ex){

//result.addValue(ex.getMessage());

}

finally{

// if (accessor!=null) accessor.close();

}

return ret;

The problem is in for sentence, this lock the system, if i comment this sentence is all ok,

What is wrong? Why can replace another sentence?

Thanks very much,

Accepted Solutions (1)

Accepted Solutions (1)

former_member181985
Active Contributor
0 Kudos

I am not able to understand what exactly you are trying to acheive with this.

for(Iterator rows = resultSet.getRows();rows.hasNext();){
ret = "1";
}

Can you explain?

>i need verify exits the data in table of database

use this statement instead of FOR.

if(rows.hasNext())
ret = "1";

Edited by: Praveen Gujjeti on Apr 8, 2009 2:53 PM

Answers (2)

Answers (2)

Shabarish_Nair
Active Contributor
0 Kudos

>

> for(Iterator rows = resultSet.getRows();rows.hasNext();){

> ret = "1";

> }

try;

for(Iterator rows = resultSet.getRows();rows.hasNext();){
Map rowMap = (Map)rows.next();
ret = "1";
}

Former Member
0 Kudos

Hi,

I guess you have to use the next() function inside the for loop to increment the rows value.

> rows.next();

Regards

Patrick