dbTalk Databases Forums  

throwing exception in parallel pipelined table function

comp.databases.oracle.server comp.databases.oracle.server


Discuss throwing exception in parallel pipelined table function in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Frank Bergemann
 
Posts: n/a

Default throwing exception in parallel pipelined table function - 12-08-2011 , 11:42 AM






what happens to such?
In my application it seems, it is catched by the main thread .
But i wonder how this can work if MULTIPLE parallel pipelined table
functions raise exception at different location of the code - e.g. for
user abort of main session(?!)

- many thanks!

regards,
Frank

Reply With Quote
  #2  
Old   
Mark D Powell
 
Posts: n/a

Default Re: throwing exception in parallel pipelined table function - 12-09-2011 , 11:40 AM






On Dec 8, 12:42*pm, Frank Bergemann <FBergem... (AT) web (DOT) de> wrote:
Quote:
what happens to such?
In my application it seems, it is catched by the main thread .
But i wonder how this can work if MULTIPLE parallel pipelined table
functions raise exception at different location of the code - e.g. for
user abort of main session(?!)

- many thanks!

regards,
Frank
I take it you mean the error is "caught" by the main session. Normal
default error handling is to stop processing and pass the error back
to the caller. If the caller does not handle the error it will be
terminated and in the case of session running SQL in parallel so would
the PQO slave sessions.

As far as if Oracle will run an SQL statement that makes use of a
pipelined function in parallel I would have to test since we have so
few of both that I am not sure I have ever seen an attempt to use both
features together.

HTH -- Mark D Powell --

Reply With Quote
  #3  
Old   
Frank Bergemann
 
Posts: n/a

Default Re: throwing exception in parallel pipelined table function - 12-12-2011 , 04:56 AM



On Dec 8, 6:42*pm, Frank Bergemann <FBergem... (AT) web (DOT) de> wrote:
Quote:
what happens to such?
In my application it seems, it is catched by the main thread .
But i wonder how this can work if MULTIPLE parallel pipelined table
functions raise exception at different location of the code - e.g. for
user abort of main session(?!)

- many thanks!

regards,
Frank
I found it out myself meanwhile
In case of MULTIPLE parallel sessions started via pipelined table
functions, there is given a dedicated exception to the main thread:
ORA-12801: error signaled in parallel query server <string>
.... instead of the concrete exception(s) raised by the individual
worker thread(s).

regards,
Frank

Reply With Quote
  #4  
Old   
Frank Bergemann
 
Posts: n/a

Default Re: throwing exception in parallel pipelined table function - 12-12-2011 , 05:46 AM



On Dec 12, 11:56*am, Frank Bergemann <FBergem... (AT) web (DOT) de> wrote:
Quote:
On Dec 8, 6:42*pm, Frank Bergemann <FBergem... (AT) web (DOT) de> wrote:

what happens to such?
In my application it seems, it is catched by the main thread .
But i wonder how this can work if MULTIPLE parallel pipelined table
functions raise exception at different location of the code - e.g. for
user abort of main session(?!)

- many thanks!

regards,
Frank

I found it out myself meanwhile
In case of MULTIPLE parallel sessions started via pipelined table
functions, there is given a dedicated exception to the main thread:
ORA-12801: error signaled in parallel query server <string
... instead of the concrete exception(s) raised by the individual
worker thread(s).

regards,
Frank
Here's a test script, if someone wants to reproduce - pls. see below.
Just change the oracle hint from
/*+ parallel(test_input,3) */
to
/*+ parallel(test_input,1) */

.... to see the difference.

regards,
Frank
------------------ snip
--------------------------------------------------------------
drop table test_input;

create table test_input (a number);

alter table test_input parallel 3;

create or replace package test_pkg
as
type rec is record (
sid number,
a number);

type tab is table of rec;

type data_cur is ref cursor return rec;

function tableFunc(
cur in data_cur)
return tab pipelined
parallel_enable(partition cur by any);

procedure do;
end;
/

create or replace package body test_pkg
as
function tableFunc(
cur in data_cur)
return tab pipelined
parallel_enable(partition cur by any)

is
rowdata rec;
sid number;
begin
select userenv('SID') into sid from dual;
dbms_output.put_line('hello from worker thread #' || sid);
rowdata.a := 10;
rowdata.sid := sid;
pipe row(rowdata);

raise ROWTYPE_MISMATCH ;

end;

procedure do
is
data tab;
sid number;
begin
sid := userenv('sessionid');
dbms_output.put_line('hello from main thread #' ||sid);
for i in 1..100 loop
insert into test_input(a) values(i);
end loop;

select * bulk collect into data from table(tableFunc
(CURSOR(select /*+ parallel(test_input,3) */ * from test_input)));

for i in data.first..data.last loop
dbms_output.put_line('got a/sid = ' || data(i).a || '/' ||
data(i).sid);
end loop;
exception when others then
dbms_output.put_line('!!! Exception:' || SQLERRM);
end;
end;
/

set serveroutput on
truncate table test_input;
declare
begin
test_pkg.do;
end;
/
------------------ snap
--------------------------------------------------------------

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.