Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index > Temporary Tables and Views

Differentiate between Regular and Temporary Tables/Views

Scroll Prev Top Next More

There are two ways to differentiate between regular and temporary tables/views. One way is to view the Tables or Views menu within the Database Explorer. You will notice that any temporary tables or views will have a faded icon next to the appropriate table/view name.

 

Another way is using the LIST command at the R> Prompt. To safely indicate which tables are temporary tables in the LIST or LIST TABLES command, you will now see a "(T)" in front of the table name.

 

Here's how using the ConComp sample database:

 

1.Launch R:BASE
2.CONNECT ConComp
3.Switch to the R> Prompt and create temporary tables using the following:

 

PROJECT TEMPORARY tCustomer FROM Customer USING ALL

 

Or use the following block of code in a command file to create two temporary tables

 

SET ERROR MESSAGE 2038 OFF

DROP TABLE tInvoiceHeader

CREATE TEMPORARY TABLE `tInvoiceHeader` +

(`TransID` INTEGER, +

`CustID` INTEGER, +

`EmpID` INTEGER, +

`TransDate` DATE, +

`BillToCompany` TEXT (40), +

`BillToAddress` TEXT (30), +

`BillToCity` TEXT (20), +

`BillToState` TEXT (2), +

`BillToZip` TEXT (10), +

`ShipToCompany` TEXT (40), +

`ShipToAddress` TEXT (30), +

`ShipToCity` TEXT (20), +

`ShipToState` TEXT (2), +

`ShipToZip` TEXT (10), +

`NetAmount` CURRENCY, +

`Freight`= ( netamount* .01) CURRENCY, +

`Tax`= ( netamount* .081) CURRENCY, +

`InvoiceTotal`= (NetAmount+Freight+Tax) CURRENCY)

COMMENT ON TABLE tInvoiceHeader IS 'Invoice Header Information'

DROP TABLE tInvoiceDetail

CREATE TEMPORARY TABLE `tInvoiceDetail` +

(`TransID` INTEGER, +

`DetailNum` INTEGER, +

`Model` TEXT (6), +

`Units` INTEGER,  +

`Price` CURRENCY, +

`Discount` REAL, +

`SalePrice`= (Price-(Price*Discount/100)) CURRENCY, +

`ExtPrice`= (Units* SalePrice) CURRENCY)

AUTONUM `DetailNum` IN `tInvoiceDetail` USING 1,1

COMMENT ON TABLE tInvoiceDetail IS 'Invoice Header Information'

SET ERROR MESSAGE 2038 ON

 

LIST TABLES

 

You will notice the (T) in front of the temporary tables.

 

4.Now create a temporary view using following:

 

SET ERROR MESSAGE 677 OFF

DROP VIEW tYTDInvoiceTotal

CREATE TEMP VIEW `tYTDInvoiceTotal` +

(CustID, YTDInvoiceTotal) AS  +

SELECT CustID,(SUM(InvoiceTotal)) FROM TransMaster +

GROUP BY CustID

COMMENT ON VIEW `tYTDInvoiceTotal` IS +

'Year-To-Date Invoice Total by Customer'

SET ERROR MESSAGE 677 ON

 

LIST VIEWS

 

You will notice (T) in front of the tYTDInvoiceTotal view.