Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: sql question

Re: sql question

From: VC <boston103_at_hotmail.com>
Date: Sun, 19 Sep 2004 19:55:14 GMT
Message-ID: <Cul3d.75898$D%.54267@attbi_s51>

<Kenneth Koenraadt> wrote in message
news:414de0bb.245234_at_news.inet.tele.dk...
> On Sun, 19 Sep 2004 17:43:34 GMT, "VC" <boston103_at_hotmail.com> wrote:
>
> >Before claiming 'it won't work', why don't you check ???
> >
> >Both versions will.
>
>
> I did check. Unlike *you*, cause if you had checked you would have
> found the following :
>
> SQL> create table table1 (col number(1));
>
> Table created
>
> SQL> select (sum(col) from table1 where col > 4) - (sum(col) from
> table1
> where col> 5) from dual;
>
> ORA-00907: missing right parenthesis
>
>
>
> - Kenneth Koenraadt
>

It did work because the original poster missed 'select' in the scalar queries. However, it does not require much intelligence to supply missing 'selects' does it:

select (select sum(col) from table1 where col > 4) - (select sum(col) from table1 where col> 5) from dual; Received on Sun Sep 19 2004 - 14:55:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US