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 -> Rowset calculations in PL/SQL

Rowset calculations in PL/SQL

From: Sven Witting <newsgroup_at_sven-witting.de>
Date: Thu, 25 Jan 2007 22:46:04 +0100
Message-ID: <45b92532$0$18834$9b4e6d93@newsspool4.arcor-online.net>

Hi,

I would like to know if (and how) the following problem can be solved in PL/SQL (using Oracle 9i and above):

For a data warehouse we need the following functionality: Depending on a drilldown-dimension (previously selected by the user) a SQL-statement has to be generated dynamically. For the resultset, a summary row has to be computed; both has to be available as an OUT Ref-Cursor of some function. This function could for example have the following signature:

function drilldown(p_dimension      varchar2,
                    p_result     out sys_refcursor,
                    p_summaryrow out sys_refcursor) return number

The function has to be able to be called from different frontends like NET-Clients or JAVA-Webapplications.

The following example shows how a resultset can principally look like:

division employees sales


division a            20     100,000.00
division b            15      70,000.00
division c             8      30,000.00

The computation of each column-summary (count, sum, avg, min, ...) is given by a metadata repository and depends on the column name or the column alias respectively.

The summary row might be computed as count, sum, sum:

3                     43      200,000.00

Is this somehow possible in PL/SQL?

Because of the possibly long runtimes of the queries, I have to avoid in any case that the statement runs twice.

Thus the following solution is not desirable:

[...]

[...]

Can anybody help?

Thank you in advance,
Sven Received on Thu Jan 25 2007 - 15:46:04 CST

Original text of this message

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