English 中文(简体)
管道职能
原标题:pipelined function

一个人能够举例说明如何在矿石板/板块中使用平行的桌子功能。 我们需要在15年内提出大量问题,并将结果结合起来。

SELECT * 
  FROM Table(TableFunction(cursor(SELECT * FROM year_table))) 

......是我们有效想要的东西。 最廉价的选取将给所有年份,表的功能将逐年进行,并进行大量盘问和交回。 我们面临的问题是,所有年份都在坐到一个桌上,我们更希望每年的桌子功能是并行的。 我们试图通过洗衣和牧场进行任何形式的分割,而且这样做没有帮助。

而且,我们能否从职能申报中删除关键词? 由于我们没有进行任何转变,因此只需要成果的汇总。

问题回答

还有其他办法(例如,通过YEAR_TABLE进行治疗并提交房舍管理司每年处理的主要工作)。 每年的工作都会将成果列入表格。

一旦完成所有 sp的工作,你就只是从桌上提取结果。

PS. I suspect parallel pipelined won t do what you want though. I created a large table with just three rows with a specific value. I then created a parallel pipelined function that just pushed out the SID of the executing process (see below) and the number of rows it processes. I had an SQL that picked out those three rows, and passed that as the the cursor into the function. Mostly the function pushed out two different SIDs (which is what EXPLAIN PLAN told me it picked as the parallelism degree). Sometimes it showed two processes had ed executed, but all three rows were processed by one of those processes.

因此,现在就没有这样的情况,即从 cur子手中夺走row子,然后转到要处理的平行奴隶,但每个平行进程都将获得一张驾驶桌的切片。 如果有小的表格,它可能不考虑平行,甚至可能只是把头50分拨到第一程序等。

CREATE OR REPLACE FUNCTION test_pp(p_source     IN SYS_REFCURSOR)
   RETURN TAB_CHAR_4000  PIPELINED
   PARALLEL_ENABLE (PARTITION p_source BY ANY)
IS
   v_num NUMBER;
BEGIN
   FETCH p_source INTO v_num;
   WHILE p_source%FOUND LOOP
            PIPE ROW(sys_context( USERENV , SID ));
            FETCH p_source INTO v_num;
   END LOOP;
     PIPE ROW(sys_context( USERENV , SID )|| : ||p_source%ROWCOUNT);
   CLOSE p_source;
   RETURN;
END test_pp;
/




相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

How to make a one to one left outer join?

I was wondering, is there a way to make a kind of one to one left outer join: I need a join that matches say table A with table B, for each record on table A it must search for its pair on table B, ...

Insert if not exists Oracle

I need to be able to run an Oracle query which goes to insert a number of rows, but it also checks to see if a primary key exists and if it does, then it skips that insert. Something like: INSERT ALL ...

How can I store NULLs in NOT NULL field?

I just came across NULL values in NOT-NULL fields in our test database. How could they get there? I know that NOT-NULL constraints can be altered with NOVALIDATE clause, but that would change table s ...

Type reference scope

I m studying databases and am currently working on a object-relational DB project and I ve encountered a small problem with the number of possible constraints in an object table. I m using "Database ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

热门标签