Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Cyclic Dependency Error when calling a procedure from inside a procedure

$
0
0

I am working on a process that dynamically builds a list of sql statements, inserts them into a table, and then loops through that table executing the statements each of which inserts one or more records in another table.

 

Here is my 'inner' procedure, please pardon any typos/messiness, I can't cut and paste.

 

CREATE PROCEDURE BLD_TABLE

BEGIN

 

DECLARE CURSOR C_REC FOR

     SELECT statement FROM STMT_TBL;

 

DECLARE cmd varchar(511);

 

FOR cur_row as c_rec do

     cmd := cur_row.statement;

     exec cmd;

END FOR;

 

END;

 

If I call this procedure on its own, it works completely fine, however if I call it from within my other procedure I get a cyclic dependency error.

 

Another really interesting thing is that it doesn't say that the error is happening in my BLD_TABLE procedure, it says it's happening in the earlier BLD_STMT_TBL procedure.  But that part of the program works completely fine, as long as I don't call this BLD_TABLE procedure at the end.

 

Paraphrased for length etc, the error is something like this:

 

Could not execute call OUTER_PROCEDURE(params):transaction rolled back by an internal error:OUTER_PROCEDURE line 47 col 2:transaction rolled back by an internal error:transaction rolled back by an internal error: BLD_STMT_TBL line 36 col 1:transaction rolled back by an internal error: Cyclic dependency found in a runtime procedure:Not allowed to call/modify runtime procedure OUTER_PROCEDURE during it's execution.

 

As you can see from the above, I don't call or modify OUTER_PROCEDURE or BLD_STMT_TBL anywhere in this procedure.  Through process of elimination, it seems to be the cursor declaration statement that it doesn't like.

 

The only thing I can think of at all is that the STMT_TBL that is being used to make the cursor is being created and populated by the earlier BLD_STMT_TBL procedure.  But I don't see why it would see that as a cyclic dependency?

 

Does anyone have any idea what this error is actually trying to tell me?


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>