Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Problem with host array and ProC

Problem with host array and ProC

From: Wolfgang Ebert <ebisoft_at_compuserve.de>
Date: Mon, 3 Jun 2002 13:36:51 +0200
Message-ID: <adfkcp$cbc$1@newsreader2.netcologne.de>


Hi,

I have a serious problem:

    EXEC SQL BEGIN DECLARE SECTION;         const char *szTheDatabase = GetDbIdentifier();

        long message2_detail_id[MAX_EVENTS];
        long nMaxEvents = MAX_EVENTS;
        long nCount;

    EXEC SQL END DECLARE SECTION;     EXEC SQL AT :szTheDatabase EXECUTE

        DECLARE coEvents MATRIX.GINA_API.T_EVENT_ARRAY;
        i        BINARY_INTEGER;
        nIndex   BINARY_INTEGER;
        BEGIN
            :nCount := MATRIX.GINA_API.GET_EVENTS(:nMaxEvents,coEvents);
            i       := 1;
            LOOP
                :message2_detail_id(i) := coEvents(i).message2_detail_id;
                i                      := i + 1;
                EXIT WHEN i > :nCount;
            END LOOP;
        END;

    END-EXEC; t_event_arry is defined as follows:

    TYPE t_event IS RECORD(

        message2_detail_id NUMBER(10), -- Id of record in

gina_message2_detail
        event_id       NUMBER(10),
        objid_ref      INTEGER,    -- PK of record which was changed
        table_id       NUMBER(10), -- entity which was changed
        database_id    NUMBER(10), -- database, where the change took place
        first_change_date DATE,    -- date of first modification
        latest_change_date DATE,   -- date of latest modification
        /* Optional parameters, if neccesary more parameters will be added
*/
        int_param_no_1  INTEGER,
        char_param_no_1 VARCHAR2(2000),
        int_param_no_2  INTEGER,
        char_param_no_2 VARCHAR2(2000),
        int_param_no_3  INTEGER,
        char_param_no_3 VARCHAR2(2000)

    );
    TYPE t_event_array IS TABLE OF t_event INDEX BY BINARY_INTEGER;

The problem is in the loop: The SP fetches 50 Records (nCount = 50), but if I try to transfer array-index 50 to "message2_detail_id" I received a "SQL-Error" 1403 and no array elements are set. If i change the query to EXIT WHEN i = :nCount everything seems ok, but only 49 elements are transfered.

Can anyone tells me what I have made wrong???

Thanks in advance

Wolfgang Ebert Received on Mon Jun 03 2002 - 06:36:51 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US