on 2014 Apr 02 10:36 AM
Our customer has an event and a stored procedure sp1 which has only 2 temporary tables declared (declare local temorary table...). After running for some hours it throws an error: Too many temporary tables in connection (SQLCODE -817).
The procedure sp1 calls another procedure sp2 many times (inside a cursor in cursor) and sp2 has 1 temp. table declared itself, but I doubt it can be the reason. From the docs:
Declared local temporary tables within compound statements exist within the compound statement.
Version: 11.0.1.2467.
Request clarification before answering.
There is a upper limit of 1,048,576 temporary tables that can be created per transaction. Dropping a temporary table will not allow you to create more than this number. Temporary tables in a transaction are assigned auto-incrementing IDs and currently the server cannot go back and 're-use' IDs of dropped temporary tables.
Is there a place where you could execute a COMMIT or reuse the same temporary table? For example, after each iteration of the cursor you could clear the temporary table and reuse it for the next iteration.
Edit: This is enhanced in version 17. The server can now go back and re-use IDs of dropped temporary tables.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
46 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.