Subject | Re: Query returning row when it shouldn't... |
---|---|
Author | phil_sorry_trouble_with_profile |
Post date | 2004-05-31T22:08:19Z |
--- In Firebird-Java@yahoogroups.com, "Steffen Heil" <lists@s...> wrote:
isNull... that is quite different from getting a ResultSet with some
data when we are not working with any rows...
> Hiproblem
>
> > 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
> is that rs.next() should return false (indicating that there is nota 'next'
> row).ment PK_SN
>
> 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
> to be an primary key (and therefor NOT NULL), but just imagine.]Well I'm quite accustomed to getting rows and having to check for
isNull... that is quite different from getting a ResultSet with some
data when we are not working with any rows...
>
> Regards,
> Steffen