Subject RE: [Firebird-Java] Query returning row when it shouldn't...
Author Steffen Heil
Hi

> java.sql.Statement s = myConnection.createStatement();
> ResultSet rs = s.executeQuery("select max(PK_SN) from MYTABLE");
> if (rs.next())
> // Then the row exists - return the value:
> return rs.getInt("PK_SN");

> This in itself is not a suprise because there are no rows... the problem
is that rs.next() should return false (indicating that there is not a 'next'
row).

Wrong. As a lot of others already stated, there is always a result to
agregate functions. NULL if necessary.

If you consider this a bug, what would you expect from the same query if
there were rows, but every row had an NULL in PK_SN? [I see, you ment PK_SN
to be an primary key (and therefor NOT NULL), but just imagine.]

Regards,
Steffen