Skip to Content
-1

Accessing HANA DB procedure via ADBC - Invalid column index (3)

Apr 12 at 09:36 PM

54

avatar image

Hi, while calling a DB procedure via ADBC using execute_query, I am getting an exception "Invalid column index (3)" during the method call next_package. any inputs on right direction would be very helpful.

Procedure:

CREATE PROCEDURE "SAPA4H"."MYPROC"( IN ID NVARCHAR(03), OUT OTAB "SAPA4H"."SCARR"))
    LANGUAGE SQLSCRIPT
    SQL SECURITY INVOKER
    READS SQL DATA AS
BEGIN
    OTAB = SELECT MANDT, CARRID, CARRNAME, CURRCODE, URL 
           FROM "SAPA4H"."SCARR" 
           WHERE CARRID = :ID;
END;

Program:

DATA it TYPE STANDARD TABLE OF scarr.
DATA ref TYPE REF TO data.
DATA lv_id TYPE S_CARR_ID VALUE 'AA'.
DATA(lv_stmt) = |CALL "SAPA4H"."MYPROC"('{ lv_id }',NULL) WITH OVERVIEW|.

GET REFERENCE OF it INTO ref.
LO_RES->set_param_table( REF ).
TRY.
  lo_res->next_package( ).
CATCH cx_root INTO lo_exp.
    DATA(LV_TEXT) = LO_EXP->GET_TEXT( ).
ENDTRY.

lv_text = Invalid column index (3)

Thanks, Vikram.M

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Matthew Billingham
Apr 13 at 05:03 AM
0

First of all, when posting code please use the little "code" button in the editor. If you cut an paste, use "paste as plain text", and do tidy the code up so it's readable.

Debug your program, and look at what the value of stmt is, just before you do the execution. This should give you a clue as to what is wrong.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Matt, apologies for the copy/paste. I will keep that in mind for the next time.

Debug and find the value for the statement was the first thing that I did. I even took the statement and executed the same in SQL console and it worked just fine.

Any other ideas?

Thanks,

Vikram.M

0

And what was that value in stmt?

0