Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NullPointerException

Status
Not open for further replies.

xzibited2

Programmer
Dec 11, 2009
9
US
Need some assistance with this. The expresion below runs fine as is, but I'm getting the above listed error whenever I change line 5 from:

and e.timestampnbr >= a.timestampnbr),

TO

and e.timestampnbr >= a.timestampnbr + 2 and e.timestampnbr < a.timestampnbr + 5),



Trying to mimic line 3, but it keeps failling out. Any thoughts?



----



1: ifnull((select top 1 c.time from timestmp c where a.date = c.date
2: and a.wrkordnbr = c.wrkordnbr and c.status in (60)
3: and c.timestampnbr >= a.timestampnbr + 2 and c.timestampnbr < a.timestampnbr + 5),
4: ifnull((select top 1 e.time from timestmp e where a.date = e.date
5: and a.wrkordnbr = e.wrkordnbr and e.status in (102)
6: and e.timestampnbr >= a.timestampnbr),
7: (select top 1 f.time from timestmp f where a.date = f.date
8: and a.wrkordnbr = f.wrkordnbr and f.status in (70)
9: and f.timestampnbr >= a.timestampnbr)
10: )) as Exp1
 
A few questions:
- What version of Pervasive are you using?
- What tool are you using to execute the query?
- What is the full and complete error?


Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
@Mirtheil - Using Summit V10, and just the standard Pervasive Control Center for now. However, this query is being wrapped into software written in vb.net.

NullPointerException is the full and complete error, with no description on what is causing the error. I narrowed it down to the line mentioned in the original post. By itself, it runs fine, but IFNULL seems to be causing it trouble.
 
Can you try the query in VB.NET or ODBC Test or something other than the PCC? If it's an engine problem, there should be more to the error than just "NullPointerException." That might be a PCC issue. Are you running the query into "Grid" or "Text" mode? Try running it using the other mode.

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
When I run in vb.net, it gives the following error:

Year, Month, and Day parameters describe an un-representable DateTime.

I ran the query in both grid and text mode in PCC, and both come up with the nullpointerexception.
 
Okay, what are the data types for both e.timestampnbr and a.timestampnbr?

What's the result of the following query:
Code:
select top 1 e.time from timestmp e where a.date = e.date and a.wrkordnbr = e.wrkordnbr and e.status in (102) and e.timestampnbr >= a.timestampnbr

and this one:

Code:
select top 1 e.time from timestmp e where a.date = e.date and a.wrkordnbr = e.wrkordnbr and e.status in (102) and e.timestampnbr >= a.timestampnbr + 2 and e.timestampnbr < a.timestampnbr + 5

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
They are integers

The top query returns a successful result and the bottom query also returns a successful result so long as it's by itself. It works okay on the first IFNULL, but not on the second nested IFNULL (returns Year, Month, and Day parameters describe an un-representable DateTime) .
 
What values are returned from each query?
WHat about this one:
Code:
select top 1 e.timestampnbr, a.timestampnbr  from timestmp e where a.date = e.date and a.wrkordnbr = e.wrkordnbr and e.status in (102) and e.timestampnbr >= a.timestampnbr + 2 and e.timestampnbr < a.timestampnbr + 5

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
01:00:00" are returned on both queries.

That query you just listed won't run in a subselect since it has two expressions. I took a.timestampnbr out (so only e.timestampnbr) and ran it, and that returns the same error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top