Link to home
Start Free TrialLog in
Avatar of boppanak
boppanak

asked on

My procedure calling another procedure gives out error code SQL0954C after 10 executions.

I have a Stored procedure with 2 IN parameters (dbname,schemaname) and 3 OUT parameters one for the count of calls to the 2nd Stored procedure and the other 2 to capture the error messages upon error handled. The procedure gets all the tables in the schema through a cursor and calls another Stored procedure by passing in the dbname,schemaname and table name as 3 parameters, which will insert one row per table into a metadata table.
I can see 10 rows getting inserted into the table and nothing happens after that. It is always 10 rows but the process should process around 150 rows.
I am either getting an error - SQL0954C Not enough storage is available in the application heap to process the statement.
Or at times it is just hanging up and no response. I had to ask the DBA to unlock the tables when ever it is getting struck.
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Hi boppanak,

Both symptoms are potential results of the same cause.  Let's see if we can to where you're always getting the same error and deal with that.

The SQL0954C error can be resolved by increasing the size of the application heap.  The default value is often too low for complex or large queries.

If DB2 is on a unix/linux server, have the DBA try this:

  db2 connect to {my_database}
  db2 get db cfg|grep APPLHEAPSZ

DB2 will report something like:

 Default application heap (4KB)             (APPLHEAPSZ) = 230

Increase the value (perhaps 300) by having the DBA enter the following:

  db2 update db cfg using APPLHEAPSZ 300

I don't recall if that's a dynamic change or if DB2 must be restarted, but it should get you past the failure at 10 calls that you're seeing.


If that doesn't actually solve the problem, you'll need to take a detailed look at the cause.  Perhaps you can post the Stored Procedures.  It sounds like you're nesting Procedure Calls, in an almost recursive fashion, but I'd like to see the code.


Good Luck,
Kent




Avatar of boppanak
boppanak

ASKER

The code is as follows ...
The execution procedure is edw_insert_all_tabs.db2 which will keep calling edw_insert_new.db2 once for each row retrieved through the cursor.
edw-insert-new.txt
edw-insert-all-tabs.txt
ASKER CERTIFIED SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial