question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Procedures with multiple result tables - Very important for SAP Hana

See original GitHub issue

System information:

  • Win 10
  • DBeaver 21.0.0

Connection specification:

  • SAP Hana

Describe the problem you’re observing:

In SAP Hana almost all procedures have multiple output parameters of type table. When I call such like this one

CALL "PUBLIC"."GET_REMOTE_SOURCE_OBJECT_TREE" ('DATALAKE_RTDI','',?,?);

in DBeaver, the first table parameter is shown but the second is not.

While less common in other databases, it can happen there as well!

For reference, Hana Studio shows all.

image

My guess is, the getMoreResults() JDBC call is not used.

CallableStatement stmt = connection.prepareCall("{CALL GET_REMOTE_SOURCE_OBJECT_TREE" ('DATALAKE_RTDI','',?,?)}"); 
boolean moreResults = stmt.execute();
while (moreResults) {
    ResultSet rs = stmt.getResultSet();
    // do something
    rs.close();
    moreResults = stmt.getMoreResults();
} 
stmt.close();   

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ShadelessFoxcommented, Jun 29, 2021

Fixed: idea64_j4KWmKplHV

As a bonus, fixed for DB2 (same problem): image

1reaction
kai-morichcommented, Apr 29, 2021

here a simple testcase

CREATE OR replace PROCEDURE proc1 (OUT tab1 sys.dummy, OUT tab2 sys.dummy, OUT val1 int, OUT val2 int) AS BEGIN
    tab1 = SELECT 'A' AS dummy FROM dummy;
    tab2 = SELECT 'B' AS dummy FROM dummy;
    val1 = 42;
    val2 = 43;
END;

CREATE OR replace PROCEDURE proc2 (OUT val1 int, OUT val2 int) AS BEGIN
    val1 = 42;
    val2 = 43;
END;

CALL proc1(?,?,?,?);
CALL proc2(?,?);

scalar results are shown at proc2 but not at proc1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Table Functions in SAP HANA – step by step guide - SAP Blogs
The main limitation of table function is that you can pass only single values for each input parameter, which can be very annoying,...
Read more >
How to protect a HANA stored procedure against multiple ...
Hi there, I have a question about stored procedure in HANA: How to protect a HANA stored procedure against multiple concurrent executions?
Read more >
Developing Procedures - SAP Help Portal
SQL queries return one result set. Procedures can return multiple result sets. Procedures can have local variables, eliminating the need to explicitly create ......
Read more >
SAP HANA Performance Guide for Developers
The SAP HANA Performance Guide for Developers provides an overview of the key features and characteristics of the SAP HANA platform from a ......
Read more >
Execute SQL Statements in SAP HANA Studio - SAP Help Portal
You can execute SQL statements in the SAP HANA studio using the SQL console. ... Multiple Result editors may open depending on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found