This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot get resultset correctly through jdbc

 
Xu Li
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have the following problem for some time now. Has anyone had such problem before and solved it? Pls. help.
The resultset returned from:
con = getConnection();
stmt = con.prepareStatement(strSql);
stmt.setString(1, userid);
stmt.setString(2, corp);
ResultSet rs = stmt.executeQuery();
while( rs.next() ){
...
}
is empty but using the same sql can get result from sqlplus. The sql is select distinct funID, disp_code, ds_name from v_sm_userpower where forbid_flag = 0 and userId = ? and pk_corp = ? and fun_property in (0, 1, 5) and group_flag <> 1 and (1=0 or fun_code like '10%' or fun_code = '20' or fun_code like '2002%' or fun_code like '2012%') order by disp_code.
the following sql also does not work: select distinct funID, disp_code, ds_name from v_sm_userpower where forbid_flag = 0 and userId = '1004AA10000000000000' and pk_corp = '1004' and fun_property in (0, 1, 5) and group_flag <> 1 and (1=0 or fun_code like '10%' or fun_code = '20' or fun_code like '2002%' or fun_code like '2012%') order by disp_code
but other userids works fine.
 
Xu Li
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ps. The v_sm_userpower is a view using union.
 
Porky Liu
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does not work means get error?
OK. one suggestion is to check the constraint of the column of userID
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic