on 04-08-2009 10:13 AM
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,
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> for(Iterator rows = resultSet.getRows();rows.hasNext();){
> ret = "1";
> }
try;
for(Iterator rows = resultSet.getRows();rows.hasNext();){
Map rowMap = (Map)rows.next();
ret = "1";
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I guess you have to use the next() function inside the for loop to increment the rows value.
> rows.next();
Regards
Patrick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.