BIRT呼叫oracle function
一.方法描述
主要是間接呼叫function .function的返回值是一個自定義型別的記憶體表。在birt中如下呼叫:select * from function_name(?,?…..);
二.例子如下:
(1)    資料庫中有如下一張表:
表名:users
欄位:id,name
(2)    首先建立一個type;
   create or replace type t_test as object(
id varchar(
10),
name varchar2(
60)
);
(3)    建立一個以上一步建立的type為基型別的記憶體表型別如下:
   create or replace type t_test_table as table of t_test;
(4)    建立如下的一個儲存過程:
create or replace function testbirt2 return
   t_test_table
   as
  
  t t_test_table:=t_test_table();
  cursor mycursor is
   select id,name
     from users;
   uid varchar(
10);
   uname users.name%type;
begin
  open mycursor;
  loop
    fetch mycursor
     into uid,uname;
    exit when mycursor%notfound;
    t.extend();
    t(t.count) := t_test(uid,uname);
  end loop;
  close mycursor;
  return t;
end testbirt2;
(5)    birt中如下呼叫:
Select * from table(testbirt2);
三.即可預覽到結果集。此例子相當簡單,只是為了證明birt如此呼叫的可行性。