Skip to Content
author's profile photo Former Member
Former Member

hana as secondary database execute query limit

Hi All,

we are currently using HANA as a secondary database and use execute_query to call some of our SP's.

I am currently facing an issue where when we call around 30+ execute statements it gives an error on all subsequent executes.

Sample code to replicate issue. In my system it reach the break-point when the count is 31.

has anyone had an issue like this ?

DATA lr_exception TYPE REF TO cx_sql_exception.
DATA lr_sql TYPE REF TO cl_sql_statement.
DATA lr_result TYPE REF TO cl_sql_result_set.
DATA lr_connection TYPE REF TO cl_sql_connection.
DATA: lv_count TYPE I,
lv_NUM TYPE char4,
lv_qurrey TYPE string.

lr_connection = cl_sql_connection=>get_connection( 'DEFAULT' ).
CREATE object lr_sql
EXPORTING
con_ref = lr_connection.


DO 100 TIMES.
lv_count = lv_count + 1.

TRY.
lv_NUM = lv_count.
CONDENSE lv_NUM.
CONCATENATE 'CREATE LOCAL TEMPORARY TABLE #TMPDATA' lv_NUM ' LIKE MAKT'
INTO LV_QURREY RESPECTING BLANKS.
lr_sql->execute_query( LV_QURREY ).
CATCH cx_sql_exception INTO lr_exception.

BREAK-POINT.
lr_connection->close( ).
EXIT.

ENDTRY.

ENDDO.
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jul 19, 2016 at 06:05 AM

    As Matt mentioned the problem occurs because of the max. size of open cursors is reached using the query method (several "dummy" result sets/cursors were opened but not closed). In a "normal" way the result set of a query is processed and the result set is closed (using the close() method of the result set object) which closes the cursor and reduces the number of open cursors. The parameter "HOLD_CURSOR" says that a cursor is left open over DB LUWs (e.g. a commit closes a cursor, setting the parameter to true, avoids that).

    But long story, short answer: The EXECUTE_QUERY method used above is wrong in that context, because no query is executed, but a DDL statement. Therefore the creation of that temporary tables has to be done using method EXECUTE_DDL of the statement object. That avoids the problem in advance.

    Regards,

    Florian

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 19, 2016 at 03:56 AM

    What error message do you get?

    This seems to be more a topic for the connection handling of NetWeaver, so I forwarded it to the ABAP for SAP HANA space.

    Lars

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 19, 2016 at 05:41 AM

    Hi Nafran/Lars,

    I am also experiencing a similar issue though it seems to be related to updates as opposed to pure execute_query commands. In my scenario, I have an ABAP program which reconciles users and roles in HANA from ABAP; and after a certain number of updates, a cx_sql_exception is raised, but the exception text and long-text are both empty which is not very useful to diagnose the issue.

    If I run the same code again; it gets a little further through the updates; with no pattern except the number of updates that have been performed.

    Anyway, just about to investigate this now. I did note the default option for execute query is to hold the cursor but no option I could see to release the cursor - so maybe that has something to do with it???

    Cheers,

    Matt

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.