1。在cognos中调用存储过程的结果集来生成报表遇到的报错和解决方法
1)创建自定义类型包
create or replace package cc11.pkg_my_types is
-- Author : SONGJIE
-- Created : 2008-9-18 14:42:08
-- Purpose : 自定义的类型
-- Public type declarations
type cursorType is ref cursor; --定义游标结果集
end pkg_my_types;
2)创建返回结果集的函数
create or replace function cc11.f_get_cur_result(intID NUMBER ) return
cc11.pkg_my_types.cursorType IS
rc cc11.pkg_my_types.cursorType;
sqlstr VARCHAR2 (500);
BEGIN
if intID=0 then
--静态测试,直接用select语句直接返回结果
open rc for select prod_id,created_date,state,block_reason from cc11.prod;
else
--动态sql赋值,用:w_id来申明该变量从外部获得
sqlstr := 'select prod_id,created_date,state,block_reason from cc11.prod where
prod_id>:aa';
--动态测试,用sqlstr字符串返回结果,用using要害词传递参数
open rc for sqlstr using intid;
end if;
return rc;
END f_get_cur_result;
3)创建返回结果集的存储过程
create or replace procedure p_test_get_prod(initID number ,rc out
cc11.pkg_my_types.cursorType ) as
sqlstr VARCHAR2 (500);