Board index » delphi » Stored Procedure Problem - Error Creating Cursor Handle

Stored Procedure Problem - Error Creating Cursor Handle

I am running D4 C/S against an Oracle 7.3 DB using native Oracle drivers
and/or ODBC drivers.

I have a stored function in Oracle whose only purpose is to return a value
of "0".  When attempting to Activate a StoredProc component pointing to this
function, I get a message returned stating:

       "Error creating cursor handle".

When I attempted to Activate the component using an ODBC driver, and when I
attempted to run the compiled Delphi program with either driver, I received
a message stating:

       "Project xxx raised exception class EDBEngineError with message
'Operation not applicable'.  Process stopped.  Use step or run to continue."

The code in the Delphi program I'm executing is:

    dmOracle.spOver01_QBE.Close;
    dmOracle.spOver01_QBE.Prepare;
    dmOracle.spOver01_QBE.ExecProc;

The stored function in Oracle I'm calling is:

Function     OVER01_QBE
   RETURN number IS
   O_PRO_DAT     date;
   O_GRP_REP_ID  varchar(4);
   O_PD_DAT      date;
   O_BNS_AMT     number;
   O_RNL_BNS_AMT number;
   CURSOR OVER01_CUR IS
       select distinct A.PRO_DAT, A.GRP_REP_ID, B.PD_DAT, SUM(A.BNS_AMT),
SUM(A.RNL_BNS_AMT)
           from REP_CMP_YTD_BNS A, REP_CMP_OVR_DAT B
           where ((A.PRO_DAT >= B.BEG_DAT) AND (A.PRO_DAT <= B.END_DAT))
           group by A.PRO_DAT, A.GRP_REP_ID, B.PD_DAT
           order by A.PRO_DAT, A.GRP_REP_ID, B.PD_DAT;
BEGIN
    open OVER01_CUR;
    loop
        fetch OVER01_CUR into O_PRO_DAT, O_GRP_REP_ID, O_PD_DAT, O_BNS_AMT,
O_RNL_BNS_AMT;
        if  OVER01_CUR%FOUND then
            ADD_YTD_BNS_RECS(O_PRO_DAT, O_GRP_REP_ID, O_PD_DAT, O_BNS_AMT,
O_RNL_BNS_AMT);
        else
            exit;
        end if;
    end loop;
    close OVER01_CUR;
    RETURN 0;
EXCEPTION
    when TOO_MANY_ROWS then
        dbms_output.put_line('Error Code:    '||sqlcode);
        dbms_output.put_line('Error Message: '||substr(sqlerrm, 1, 100));
        RETURN 2;
    when INVALID_CURSOR then
        dbms_output.put_line('Invalid Cursor');
        RETURN 3;
    when others then
        dbms_output.put_line('Error Code:    '||sqlcode);
        dbms_output.put_line('Error Message: '||substr(sqlerrm, 1, 100));
        RETURN 9;
END; -- Function OVER01_QBE

Please let me know any ideas about how I can resolve this situation.
Thanks.

Dan Smith
DSm...@bma.com

 

Re:Stored Procedure Problem - Error Creating Cursor Handle


Did you name the parameter result?  Is ENABLE INTEGER true?  If so
ptInteger else
ptFloat.  What you're doing looks fine.

John

Other Threads