db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dag.Wan...@Sun.COM (Dag H. Wanvik)
Subject Re: Question about FETCH FIRST
Date Mon, 27 Apr 2009 20:51:09 GMT

Hi Tiago,

thanks for testing this new feature!

Tiago Espinha <tiago@espinhas.net> writes:

> The question is about the following SQL statement:
>   select * from t1 fetch first 0 rows only;

According to the latest SQL standard draft that I've been able to see,
this should give an error, cf. section 7.13 (quote):

7.13 <query expression>

General Rules
8) If <fetch first clause> is specified, then:
   a) Let OCT2 be the cardinality of T.

      NOTE 212 - OCT2 is the cardinality of T after the removal of any
      rows from T by the application of the prior General Rule.
   b) Case:

       i) If <fetch first row count> is specified, then let FFRC be
       the value of <fetch first row count>.

       ii)     Otherwise, let FFRC be 1 (one).

   c) If FFRC is less than 1 (one), then an exception condition is
       raised: data exception - invalid row count in fetch first

I would have liked the semantics you suggest, but for prudence I think
we should stick with the standard for now. We could always be more
liberal later, it is harder to remove something people already rely


View raw message