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: How to calculate the sum of an item from a result set of a query.

Re: How to calculate the sum of an item from a result set of a query.

From: WvA <wesselX_at_wau.misX.ah.nl>
Date: Thu, 7 May 1998 06:22:18 GMT
Message-ID: <EsKpJ4.FGn@wau.mis.ah.nl>


Maybe you could write a stored procedure which uses the DBMS_SQL package. Then you can pass the where-clause as an input parameter and return the totals as output parameters.

--

Wessel van Alphen.
Please remove all X's from my E-mail account when replying.

Quang Vu wrote in message <35513D2E.DF786EFE_at_cadvision.com>...
>After the query is perform, I can extract the where clause from
>the SYSTEM.LAST_QUERY and store it in a varchar last_whereclause
>(the content of this whereclause can be anything) .
>
>What I want to do in the post-query is somehow to execute the select
>statement:
> SELECT SUM(QUANTITY) FROM B WHERE ORDER# IN (SELECT ORDER# FROM A WHERE
>ORDER# >= 1000).
>The WHERE clause in the inner SELECT statement can be anything. (that's
>why I extracted the
>WHERE clause in SYSTEM.LAST_QUERY).
>
>My problem is how to combine the var last_whereclause into that
>statement when building
>a cursor (cursor declaration does not accept the sign ||).
>
>Can anyone help me or direct me to some other way to solve this problem.
>
>Thanks in advance.
>
>Quang Vu
>
>
>
Received on Thu May 07 1998 - 01:22:18 CDT

Original text of this message

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