Question

In this link IBM they explain how to use an Oracle stored procedure with COGNOS.

They are doing :

create or replace package body project_pk as
procedure project_sp (tproj IN numeric, result1 in out project_type1) is

begin
open result1 for
select projects.projectid, projects.projecttype
from projects
where projects.projecttype=tproj;
end;
end;
/

With open result1 for they are opening the cursor explicitly. But, they do not seem to close it. Why is this?

Was it helpful?

Solution

You must return resuly set to Cognos. If you close the cursor then there are nor reuslts, right?
It's Cognos responsibility to close the cursor, once it finishes to pull the data from the SP.
In order to make you 100% sure that this is the case look at this link (totaly unrelated to Cognos):
Returning result Sets from SQL Server and Oracle

However, the sample you gave in your link, looks quite complex. Here is what I am using:

CREATE OR REPLACE PROCEDURE "COGNOS_SP" (
case_id        in numeric,
po_refcur      out sys_refcursor) is
BEGIN
   open po_refcur for 
   select * FROM CASES WHERE CASE_ID = case_id;
END COGNOS_SP;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top