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

Usage of Stored procedure in Calculation View

Hi Experts,


I have created a non read only procedure in HANA using SQL Console, But when i try to use that in my calculation view, I still get an error that it is read only procedure. I havent written "READS SQL DATA As" in my procedure, So it should be a read/write procedure. Could you please help me with any alternative?



Code :

create procedure "MYSCHEMA".PROCEDURE_TEST()

language sqlscript as

begin

DECLARE tname varchar(50);

SELECT TABLE_NAME into tname FROM "MYSCHEMA"."TEST_TABLE" WHERE ID ='5';

execute immediate ('select'||'*'||'from'||tname) ;

END;

In calculation View :

EXEC 'call "MYSCHEMA".PROCEDURE_TEST();

call "MYSCHEMA"."PROCEDURE_TEST"(varout);

Tried Both, But getting the error for both syntax as below :

"CALL for non read only procedure/function is not supported in the READ ONLY procedure/function"

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on May 07, 2015 at 04:07 AM

    The error is saying that you cannot call a non read-only procedure (PROCEDURE_TEST) from a read-only procedure (Calc Views are by default read-only).

    This makes perfect logical sense - a read only procedure is obviously supposed to only read data, that's the basic definition. The idea is that the execution of a read-only procedure must not change any data in the system. Now if it had the capability to call a non read-only procedure, that makes the above definition entirely invalid. The very term "read-only" becomes meaningless.

    So basically, the system will only allow you to call a read-only procedure from another read-only procedure. Instead, please rewrite PROCEDURE_TEST to be a read-only procedure.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 16, 2015 at 04:19 PM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 16, 2019 at 08:09 AM
    Hi Jyotsna,
    You can achieve your requirement by creating HANA Table Function. Table function can be called from Calculation view by adding projection or aggregation nodes. You can 
    write SQL statements in the function. 
    Mainly, HANA stored procedures are used for DML (insert/ update/ delete)  
    operations.
    
    Regards
    Kedar
    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.