Re: Should this query raise an exception?

From: Alan <alanshein_at_erols.com>
Date: Fri, 16 Aug 2002 12:33:46 -0400
Message-ID: <ajj9a2$19rvhv$1_at_ID-114862.news.dfncis.de>


I'm not sure I fully understand your question and how it relates to your example, but from what I can see, the query will divide by 1, not 0, so of course there would not be an exception.

"Steve Kass" <skass_at_drew.edu> wrote in message news:3D5CF934.7079644E_at_drew.edu...
> The following returns a result set and no exception
> in Microsoft SQL Server, IBM DB2, or Ocelot, and I can't
> find anything in the SQL-92 standard to help me decide
> whether it should succeed according to ANSI.
>
> If the derived table were fully materialized, a divide-by-zero
> exception should occur, but the search condition excludes
> the row where the exception occurs.
>
> Since the usual explanation of how a query works logically
> refers to the entire derived query as the table source, should
> the query fail?
>
> create table t (
> a integer,
> b integer
> )
>
> insert into t values (0,0)
> insert into t values (1,1)
>
> select * from (
> select
> 1/a as R,
> b
> from t
> ) v where b<>0
>
> drop table t
>
> Steve Kass
> Drew University
>
Received on Fri Aug 16 2002 - 18:33:46 CEST

Original text of this message