too many temporary tables in connection

Item Value
SQLCODE -817
Constant SQLE_TOO_MANY_TEMP_TABLES
SQLSTATE 52W41
Sybase error code 13823
ODBC 2 State ERROR
ODBC 3 State ERROR

Probable cause 

A CREATE TABLE or DECLARE TABLE statement attempted to create a temporary table, but the resulting number of distinct table ids used for temporary tables in the current connection would exceed the limit.