Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling stored procedure via MS ODBC
Message
From
21/07/2001 11:56:09
 
 
To
21/07/2001 11:02:15
Gunawan Santoso
Pt. Japfa Comfeed Indonesia
Surabaya, Indonesia
General information
Forum:
Oracle
Category:
Other
Miscellaneous
Thread ID:
00533450
Message ID:
00533529
Views:
10
>Pardon?

Sorry that looks right...

I haven#t had occation to do this yet but here is the code from the thread that
aparently works.


Not my code!

Create a package that returns a reference cursor. Pass this to your procedures within the package body. Each procedure will create a set of records by declaring a cusor and pass that back to you application. The call to the procedure from SQLEXEC is the same except you must reference the package body in the call:

retval = SQLEXEC( nHandle, '{CALL ReturnCursors.GetCustTrans}', tmpCursor )

I have placed the code for one of my packages below:
CREATE OR REPLACE PACKAGE ReturnCursors AS
TYPE RetCursor IS REF CURSOR;

PROCEDURE GetExpRecords(p_cursor OUT RetCursor,
InSource IN VARCHAR2);

PROCEDURE GetCustTrans(p_cursor OUT RetCursor);

PROCEDURE GetAccountList( p_cursor OUT RetCursor );

END ReturnCursors;
/

CREATE OR REPLACE PACKAGE BODY ReturnCursors AS

PROCEDURE GetExpRecords(p_cursor OUT RetCursor, InSource IN VARCHAR2) IS
BEGIN

OPEN p_cursor FOR
        SELECT RTRIM (product_id) expcode, RTRIM (charge_name) expcodename,
                RTRIM (charge_type) chargetype
           FROM vwLastChargeDetails
     WHERE RTRIM(product_id) IN
        (SELECT RTRIM(expcode)
        FROM expcodes
       WHERE RTRIM(source) = InSource);
END GetExpRecords;

PROCEDURE GetCustTrans(p_cursor OUT RetCursor) IS
BEGIN
OPEN p_cursor FOR
  SELECT * FROM custtrans;

END GetCustTrans;

PROCEDURE GetAccountList( p_cursor OUT RetCursor ) IS
BEGIN
OPEN p_cursor FOR
  SELECT account_number, relationship_name
    FROM fnbaa.relationship
   WHERE account_number IS NOT NULL
     AND close_date IS NULL;

END GetAccountList;


END ReturnCursors;
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform