Select nvl(max(c.EmployeeId),0) in JPQL?
ejbql, java, jpql, persistence
Solution
`NVL()` is supported now in newer versions of jpql
Problem
I'm using oracle10g database and eclipselink, I need to obtain the last inserted key from the table so i've created this query ``` javax.persistence.Query q = em.createQuery("SELECT nvl(MAX(c.myAtt),0) " + "from myTable as c"); return Integer.parseInt(q.getSingleResult().toString()); ` ``` But when the table is empy(sometimes it might get empty) i'm getting ILEGAL ARGUMENT EXCEPTION, cause: JPQL Exception, detail: "An exception occurred while creating a query in EntityManager". What i'm doing wrong?