BlueAndSilver
MIS
I am able to create an Access 2003 pass-through query to Oracle 10g that uses a SELECT statement; it returns a resultset. But, I cannot get a resultset when I try to execute an Oracle stored procedure in a pass-through. I set the stored procedure up with a SYS_REFCURSOR in it. The SP must have a reference cursor to return the resultset. How do I execute this in Access 2003? I have used the following syntax with IN date parameters: EXEC HREMPINFO('1-Jan-1900', '31-Dec-2005'); [and other variations] I also tried putting the name of the stored procedure between a begin...end block in the pass-through query, that didn't work. I believe the problem is that the oracle stored procedure ref_cursor is looking for a local variable or ref_cursor to send the resultset to in the pass-through query. How do I set this up? Thanks in advance.
Below is an example of returning the recordset using a stub in Oracle. He is able to declare a local variable ref cursor.
– Here we have declared cursor variable of type cursorType as an output variable.
CREATE OR REPLACE PROCEDURE DEC_RTN_RECORDSET
(
p_InvoiceDate IN DATE,
p_ResultSet OUT TYPES.cursorType
)
AS
BEGIN
OPEN p_ResultSet FOR
SELECT Invoice_Number, Invoice_Date, Client_ID, Invoice_Amt
FROM Invoice
WHERE Invoice_date <= p_InvoiceDate
ORDER BY Invoice_number;
END DEC_RTN_RECORDSET;
/
– Testing
VARIABLE resultSet REFCURSOR
EXEC DEC_RTN_RECORDSET(sysdate, :resultSet);
PRINT :resultSet
Below is an example of returning the recordset using a stub in Oracle. He is able to declare a local variable ref cursor.
– Here we have declared cursor variable of type cursorType as an output variable.
CREATE OR REPLACE PROCEDURE DEC_RTN_RECORDSET
(
p_InvoiceDate IN DATE,
p_ResultSet OUT TYPES.cursorType
)
AS
BEGIN
OPEN p_ResultSet FOR
SELECT Invoice_Number, Invoice_Date, Client_ID, Invoice_Amt
FROM Invoice
WHERE Invoice_date <= p_InvoiceDate
ORDER BY Invoice_number;
END DEC_RTN_RECORDSET;
/
– Testing
VARIABLE resultSet REFCURSOR
EXEC DEC_RTN_RECORDSET(sysdate, :resultSet);
PRINT :resultSet