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

Home -> Community -> Usenet -> c.d.o.misc -> Re: query trigger

Re: query trigger

From: andrewst <member14183_at_dbforums.com>
Date: Wed, 21 May 2003 19:56:31 +0000
Message-ID: <2907946.1053546991@dbforums.com>

Originally posted by Drukqs
> andrewst wrote in news:2901810.1053445949_at_dbforums.com:"]news:2-
> 901810.1053445949_at_dbforums.com:[/url]
>
> > SELECT pcnr, n
> > INTO :testblock.pc, :testblock.number
> > FROM
> > (
> > SELECT pcnr, sum(number) AS n
> > FROM orders
> > GROUP BY pcnr
> > ORDER BY sum(number) desc
> > )
> > WHERE ROWNUM = 1;
>
> This gives this error when I compile:
> Encountered the symbol "ORDER" when expecting one of the following
> .(),*@ and so on........
>
> What shall I do?

OK, so probably your version of Forms doesn't support ORDER BY within inline views either. But that's OK, you can do this instead:

FOR r IN
( SELECT pcnr, sum(number) AS n
  FROM orders
  GROUP BY pcnr
  ORDER BY sum(number) desc
)
LOOP
  :testblock.pc := r.pcnr;
  :testblock.number := r.n;
  EXIT;
END LOOP;

--
Posted via http://dbforums.com
Received on Wed May 21 2003 - 14:56:31 CDT

Original text of this message

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