ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Oracle Stored Procedure - REF CURSOR

Post new topic  Reply to topic
 Oracle Stored Procedure - REF CURSOR « View previous topic :: View next topic » 
Author Message
fcotait
PostPosted: Thu Jul 15, 2004 6:56 am    Post subject: Oracle Stored Procedure - REF CURSOR Reply with quote

Acolyte

Joined: 28 Feb 2002
Posts: 63
Location: Sao Paulo - Brazil

Hi all,

I'm trying to call a Oracle Stored Procedure with REF CURSOR parameter.

How can I pass a REF CURSOR to Oracle through the WBIMB compute node ?

My WBIMB version is 5 with CSD 3 and the Oracle9i

The SP DESC is:

Code:
SQL> desc SICAD.P_SICCABINIF;
PROCEDURE SICAD.P_SICCABINIF
Argument Name                  Type                    In/Out Default?
------------------------------ ----------------------- ------ --------
P_CURSORBINIF                  REF CURSOR              IN/OUT
                               RECORD                  IN/OUT
     BIN                       VARCHAR2(8)             IN/OUT
     ENTLRON                   VARCHAR2(2)             IN/OUT
P_CODIF                        VARCHAR2                IN


and my ESQL code:

Code:
CREATE COMPUTE MODULE Ate_01_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
               
                CALL CopyEntireMessage();
      
      DECLARE P_CursorBinIF CHAR;
      DECLARE P_CodIF CHAR;
      
      SET P_CodIF = InputRoot.XML.Dados.Bin;
      SET P_CursorBinIF = ' ';

      CALL StrProced(P_CursorBinIF, P_CodIF);
            
      RETURN TRUE;
   END;

   CREATE PROCEDURE StrProced (
       INOUT Parm1 CHAR,
       IN    Parm2 CHAR
   ) EXTERNAL NAME "SICAD.P_SICCABINIF";

   CREATE PROCEDURE CopyMessageHeaders() BEGIN
      DECLARE I INTEGER 1;
      DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
      WHILE I < J DO
         SET OutputRoot.*[I] = InputRoot.*[I];
         SET I = I + 1;
      END WHILE;
   END;

   CREATE PROCEDURE CopyEntireMessage() BEGIN
      SET OutputRoot = InputRoot;
   END;
END MODULE;


I already changed the variable value P_CursorBinIF for many types, how: NULL, '', ' ', etc...


Any Idea ?

Thanks
_________________
Filipe Cotait
IBM Certified System Administrator - WebSphere MQ
IBM Certified Specialist - MQSeries, WebSphere MQ Integrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
JT
PostPosted: Wed Jul 21, 2004 8:01 am    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

fcotait,

Is it possible to preface the call to the SICAD.P_SICCABINIF stored-procedure with a call to another stored-procedure that 'converts' (as you can see I'm database-lliterate) the in-bound P_CursorBinIF (Parm1) to the ref_cursor?

Earlier this year we had a similar requirement, but in reverse. We needed to invoke legacy Oracle stored-functions that returned the resultset as a ref_cursor. Since WBI (Merant driver) didn't support this data type, we prefaced the call to the stored function with another function. It's purpose was to 'convert' the ref_cursor to a CLOB using the DBMS_XMLGEN function.

The legacy stored-function looked something like this:
Code:
function getProductFunds(pProdId in number) return psa_refcur_pkg.refcur_t is
  ResultSet psa_refcur_pkg.refcur_t;
begin
 OPEN ResultSet FOR
   select pf.*, f.* from productfund pf, fund f
     where
      f.TYPECODE = 'V' and
       (f.TERMINATIONDATE IS NULL or f.TERMINATIONDATE >= sysdate)  and
       (f.CLOSEDTONEWSALESDATE IS NULL or pf.TERMINATIONDATE >= sysdate)
       and (pf.TERMINATIONDATE IS NULL or pf.TERMINATIONDATE >= sysdate) and
      pf.FUNDCODE=f.FUNDCODE and pf.PRODUCTID=pProdId
       order by  pf.TERMINATIONDATE desc,  f.TERMINATIONDATE desc, f.FUNDNAME;
  return ResultSet;
end getProductFunds;

We created this function to call the one above:
Code:
function getProductFunds_XML(pProdId in number) return clob is
  l_xml clob;
  qryCtx DBMS_XMLGEN.ctxHandle;
begin
  qryCtx := dbms_xmlgen.newContext('select PRODUCTSA.productcentral_pkg.getProductFunds(' || '''' || pProdId || '''' || ')  RESULTS from dual');
  l_xml  := DBMS_XMLGEN.getXML(qryCtx);
  dbms_xmlgen.closeContext(qryCtx);
return l_xml;
  exception
    when others then
    dbms_xmlgen.closeContext(qryCtx);
    raise;
end getProductFunds_XML;

Hope this gives you some ideas/possibilities?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Oracle Stored Procedure - REF CURSOR
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.