Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Playing with PIPELINED Functions

Playing with PIPELINED Functions

From: Rene Nyffenegger <Rene.Nyffenegger_at_gmx.ch>
Date: 26 Jun 2002 01:46:33 -0700
Message-ID: <ce60f507.0206260046.762124b7@posting.google.com>


Hello

I am fascinated by the pipelined functions offered in 9i. They seem to make some queries a little easier. In order to get familiar with these, I wrote the following little types an function. The purpose of the funcion is to show how many bytes were sent to the client in an interval of one second. However -and a little unexpected- Oracle seems to deliver the input to a 'pipe row' not until two calls to it have been made (except after the first call.). Is there a way to change this behaviour (pragma, init parameter, anything?)

Rene

set arraysize 1
alter session set nls_date_format='dd.mm.yyyy hh24:mi:ss';

create or replace type o_date_varchar2 as object (   d date,
  v varchar2(99)
)
/

create or replace type t_date_varchar2 as table of o_date_varchar2
/

create or replace function f_date_varchar2(j in integer) return t_date_varchar2   pipelined
as
  a_date_varchar2 o_date_varchar2 := o_date_varchar2(null,null); begin
  for a in 1..j loop
    select to_char(value), sysdate

      into  a_date_varchar2.v, a_date_varchar2.d 
      from  sys.v_$sysstat 
      where name ='bytes sent via SQL*Net to client';

    pipe row (a_date_varchar2);
    sys.dbms_lock.sleep(1);
  end loop;
  return;
end;
/

show errors

select * from table(cast(f_date_varchar2(20) as t_date_varchar2));   

drop function f_date_varchar2;
drop type t_date_varchar2;
drop type o_date_varchar2;

set arraysize 15 Received on Wed Jun 26 2002 - 03:46:33 CDT

Original text of this message

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