Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index > Temporary Tables and Views

Using Temporary Tables/Views

Scroll Prev Top Next More

Creating Temporary Tables/Views

Use the CREATE TEMPORARY TABLE command to create a temporary table. Use the CREATE TEMPORARY VIEW command to create a temporary view. You can also use the PROJECT command to create a temporary table based upon another table. The main difference between using the original command to create a table or view and creating a temporary table/view is the TEMPORARY parameter in the command syntax.

 

Temporary Table Setting

Within the R:BASE Data Designer, there is a setting, under "Table", that will save any temporary table as a regular permanent table. The setting can also be used to save any existing table as a temporary table.

 

Removing Temporary Tables/Views

You can use the DROP command to remove a temporary table or view. This is important when you are creating temporary tables or views as you should always DROP the table or view before creating it. This technically only affects the user running the program. To avoid this error message, use the following technique:

 

Example 01:

SET ERROR MESSAGE 2038 OFF

DROP TABLE temptablename

SET ERROR MESSAGE 2038 ON

 

Example 02:

SET ERROR MESSAGE 677 OFF

DROP VIEW tempviewname

SET ERROR MESSAGE 677 ON

 

In addition to the DROP command, you can simply DISCONNECT and CONNECT the database to remove any temporary tables/views. Temporary tables/views along with temporary System Tables are removed when the database is disconnected.

 

Using Forms, Labels or Reports based upon Temporary Tables/Views

You may define all required TEMPORARY tables/views for Forms as "On Before Design Action" before designing a form and "On Before Start" EEP before using (EDIT USING, ENTER USING, BROWSE USING) the form.

 

You may define all required TEMPORARY tables/views for Reports as "On Before Design ..." action before designing a report/sub-report and "On Before Generate ..." action.

 

You may define all required TEMPORARY tables/views for Labels as "On Before Design ..." action before designing a label and "On Before Generate ..." action.
 

A command file, such as TempTables.RMD, can also be used to pre-define all required temporary tables/views.

 

Notes:

 

In regards to temporary tables in the database, always DISCONNECT and then CONNECT before using the AUTOCHK, PACK or RELOAD commands.

 

When creating a temporary table/view, the following temporary System Tables are also created:

 

SYSTMP_COMMENTS

SYSTMP_CONSTRAINTS

SYSTMP_DEFAULTS

SYSTMP_RULES

SYSTMP_SERVERS

SYSTMP_TRIGGERS

SYSTMP_VIEWS

 

Temporary tables/views were first introduced in R:BASE 6.1 (July 1997).