博客统计信息

51cto博客之星
用户名:leizhimin
文章数:583
评论数:1875
访问量:5112710
无忧币:14589
博客积分:15350
博客等级:10
注册日期:2006-11-01

BIRT调用oracle function
2006-11-10 16:49:48
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如此调用的可行性。
分享至
更多
一键收藏,随时查看,分享好友!
0人
了这篇文章
类别:UML技术圈()┆阅读()┆评论() ┆ 推送到技术圈返回首页

文章评论

 
2006-11-14 12:14:29
不错!谢谢博主

 

发表评论            

【技术门诊】专家解析:软考重点难点及应试技巧
昵  称:
登录  快速注册
验证码:

请点击后输入验证码博客过2级,无需填写验证码

内  容: