Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index > Temporary Tables and Views

Removing Temporary Tables/Views

Scroll Prev Top Next More

The DROP command may be used to remove a temporary table or view from a database. Removal is important when creating temporary tables/views as the table or view should always be dropped before creating it. Technically, the recommendation only affects the user running the program, but the logic ensures repeated temporary tables/views use as seamless.

 

In instances where the table or view does not exist and the DROP command is issued, the expected error message 2038 or 677 will appear stating the table/view does not exist. To avoid the error, set the error message off using the following technique:

 

SET ERROR MESSAGE 2038 OFF

DROP TABLE TempTableName

SET ERROR MESSAGE 2038 ON

 

SET ERROR MESSAGE 677 OFF

DROP VIEW TempViewName

SET ERROR MESSAGE 677 ON

 

Prior to the DROP command, the CHKTABLE function or a query of the SYS_TABLES system table may be used to confirm if a table/view exists.

 

In addition to the DROP command, the database can also be disconnected to remove all temporary tables and views. Temporary tables/views along with temporary system tables are removed when the database is disconnected.