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 » Getting an array from Oracle

Post new topic  Reply to topic
 Getting an array from Oracle « View previous topic :: View next topic » 
Author Message
kevinobyrne
PostPosted: Wed Jul 03, 2013 8:55 am    Post subject: Getting an array from Oracle Reply with quote

Voyager

Joined: 17 Jul 2007
Posts: 83
Location: Ireland

Using WMB 7.0.0.5 and Oracle 11.2

Is it possible to call a stored procedure that returns an array? For example, it would return a ROW/LIST into your flow?

e.g.

Code:
CREATE PROCEDURE FnGetPaymentIds(   IN BatchId INTEGER)
      RETURNS INTEGER LANGUAGE DATABASE EXTERNAL NAME "SCH.PKGMW_INTERFACE.fn_get_payment_ids";

Then calling it with

Code:
   DECLARE Payments ROW;
      
   CALL FnGetPaymentIds(1) INTO Payments;


I'm getting "optional feature not implemented" with this. I also tried to get the procedure to return a ROW type but that wouldn't deploy.

Would I be better off just getting the DB procedure to do the work, returning something like a list of comma separated values in a CLOB?

Thanks for any suggestions.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Wed Jul 03, 2013 8:57 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Store the array into a temp table then do a select * on the temp table.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
kash3338
PostPosted: Wed Jul 03, 2013 9:38 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

Guess there is a option to return array as result set in Oracle

Or it may be the other way round , not very sure, you can have a try.

If this is possible, you can use dynamic result sets.
Back to top
View user's profile Send private message Send e-mail
kevinobyrne
PostPosted: Thu Jul 04, 2013 2:30 am    Post subject: Reply with quote

Voyager

Joined: 17 Jul 2007
Posts: 83
Location: Ireland

Thanks, result sets worked for me:


Code:
PROCEDURE sp_get_payment_ids (pBatchId IN NUMBER,
                                          pCursor OUT sys_refcursor)       
    AS
        tabPaymentMessages   payment_messages_tab;
    BEGIN
      OPEN pCursor FOR
        SELECT payment_id
          BULK COLLECT INTO tabPaymentMessages
          FROM batch_messages
         WHERE batch_id = pBatchId;
           
    END sp_get_payment_ids;


Then my esql was:

Code:
CREATE COMPUTE MODULE MF_TEST_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      CALL CopyMessageHeaders();      
      
      DECLARE BatchId INTEGER CAST(InputRoot.XMLNSC.Msg.BatchId AS INTEGER);         
      DECLARE Batch ROW;
      
      CALL SpGetPaymentIds(BatchId, Batch.Payment[]);
                  
    SET OutputRoot.XMLNSC.Batch = Batch;
      
      RETURN TRUE;
   END;
END MODULE;

CREATE PROCEDURE SpGetPaymentIds (   IN pBatchId INTEGER)
      LANGUAGE DATABASE DYNAMIC RESULT SETS 1 EXTERNAL NAME "SCH.PKGMW_INTERFACE.sp_get_payment_ids";
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 » Getting an array from Oracle
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.