Home » SQL & PL/SQL » SQL & PL/SQL » Result Set from ref cursor into pro*c variables
Result Set from ref cursor into pro*c variables [message #40313] Thu, 26 September 2002 11:08 Go to next message
prazak
Messages: 3
Registered: September 2002
Junior Member
Yo.
I am having trouble getting the results out of my result set I called into my pro*c variables.

Here is the table desc:
SQL*PLUS<FITSD1>desc fits_discrete_values
Name Type
----------- --------
KEY_WORD VARCHAR2(20)
DISC_VALUE VARCHAR2(80)

Here is the i'm using procedure in the fitcheck package:
CREATE OR REPLACE PACKAGE fitcheck
IS
TYPE helpCursor IS REF CURSOR;
PROCEDURE help1b (c_help IN OUT helpCursor);
END fitcheck;

CREATE OR REPLACE PACKAGE BODY fitcheck
IS
PROCEDURE help1b (c_help IN OUT helpCursor)
IS
BEGIN
OPEN c_help FOR
SELECT disc_value
FROM fits_discrete_values
WHERE key_word LIKE 'HELP_DR_H1_%'
ORDER BY key_word;
END help1b;
END fitcheck;

Here is the relevant pro*c code that calls the stored procedure. I have determined that the error handler is invoked during the fetch call, ouputting the following message:

"Error 666 = Error while trying to retrieve text for error ORA-01002"

getHelp()
{
exec sql begin declare section;
sql_cursor a_cursor;
varchar text[[80]];
exec sql end declare section;
exec sql whenever sqlerror goto Error666;
exec sql allocate :a_cursor;
text.len = 80;

EXEC SQL CALL fitcheck.help1b(:a_cursor);
EXEC SQL FETCH :a_cursor INTO :text;
EXEC SQL CLOSE :a_cursor;

Error666:
fprintf(stdout,"nError 666 = %sn",
sqlca.sqlerrm.sqlerrmc);
}

I suspect that somehow my text variable is bad. Any help?
Re: Result Set from ref cursor into pro*c variables [message #40315 is a reply to message #40313] Thu, 26 September 2002 12:58 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
I know nothing about Pro*C, but here is a template that has a slightly different layout than yours:

http://osi.oracle.com/~tkyte/ResultSets/index.html
Read that one [message #40316 is a reply to message #40313] Thu, 26 September 2002 13:06 Go to previous message
n.prazak
Messages: 1
Registered: September 2002
Junior Member
Ya, I started with that article. It's good. I will try and do it exactly how Tom does. Thanks.
Previous Topic: Re: Retrieving records N to N+10 !! Perplexed
Next Topic: Re: Retrieving records N to N+10 !! Perplexed
Goto Forum:
  


Current Time: Sun Apr 28 20:17:05 CDT 2024