Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

What exactly is parallelised in pipelined functions?

rahulrasNov 17 2011 — edited Nov 18 2011
Hi All,

I have a slight confusion about pipelined table functions, which are parallelised (with PARALLEL_ENABLE clause).
Everywhere on the internet/documents it is mentioned that, we can use PARALLEL_ENABLE with pipelined table functions, I am not clear about exactly how this will work?

For example, I have a pipelines function, which is called by C# code to write data in file ( Oracle v11.2 on Linux 64bit). Function looks something like
FUNCTION extract_data (param1..., param2...., param3.... )
RETURN data_tab  /* this data_tab is table of record type data_rec */
PIPELINED
IS
     v_data_rec      data_rec := data_rec ( null, null,....., null);
BEGIN

  FOR i_rec IN ( select col1, col2, col3,.... FROM table1, table2 WHERE <all typical stuff here> )
  LOOP
          v_data_rec.col1 := i_rec.col1 ;
          v_data_rec.col2 := i_rec.col2 ;
          v_data_rec.col3 := i_rec.col3 ;

          if v_data_rec.col1 = 'A' then
              select col into v_data_rec.col4 from tablex where .... ;
          elsif v_data_rec.col1 = 'B' then
              select col into v_data_rec.col4 from tabley where .... ;
          elsif v_data_rec.col1 = 'C' then
              select col into v_data_rec.col4 from tablez where .... ;
          elsif v_data_rec.col1 = 'D' then
              select col into v_data_rec.col4 from tablet where .... ;
          end if ;

          /* some more bits of complex logic here */

          PIPE ROW ( v_data_rec ) ;

  END LOOP ;

END extract_data ;
Now, if I add PARALLEL_ENABLE to my function definition, which bits will be parallelised? will anything be parallelised ?
Thoughts please.

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 16 2011
Added on Nov 17 2011
7 comments
176 views