Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

query problem

 
Bill Brasskey
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my jsp, I'm trying to pull data from a MS SqlServer 2000 db.I have a panelists table and a survey table. Panelists primary=record_id, which relates to panelist_id in the survey table. I want to pull data for panelists who have yet to complete a survey(i.e. panelists.record_id != surveys.panelist_id). I'm getting a null pointer exception. When I do a query for panelists who have completed a survey(i.e. panelist.record_id=surveys.panelist_id), the dataset comes back fine.
I'm new to programming, and I realize this doesn't relate too much to jdbc, but any advice will be greatly appreciated.
[ June 28, 2004: Message edited by: Bill Brasskey ]
 
Sadanand Murthy
Ranch Hand
Posts: 382
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not knowing how you have written your sql & your jsp makes it rather difficult to determine the cause of the NPE. Look at the stack trace; it will tell you which line of code generated the NPE. Then look at that line # in the .java file that would have been generated from your jsp and try to determine the reason for the NPE.

Are you using a minus query to get the appropriate result set?
select col1, ... from table 1
minus select col2, ... from table 2

Or you can use something like this:
select col1,... from table 1 where id not in (select id from table 2)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic