Creating a Local Table
- Last Updated: May 15, 2020
- 2 minute read
- DataDirect Connectors
- JDBC
- IBM Db2 5.1
- MySQL 5.1
- Progress OpenEdge 5.1
- SAP Sybase 5.1
- Documentation
Purpose
Creates a new table. You can create either a remote or local table. A remote table is a Salesforce object and is exposed in the SFORCE schema. Creating a table in the SFORCE schema creates a remote table. A local table is maintained by the driver and is local to the machine on which the driver is running. A local table is exposed in the PUBLIC schema. Creating a table in the PUBLIC schema creates a local table.
Syntax
CREATE [{MEMORY | DISK | [GLOBAL] {TEMPORARY | TEMP}]
TABLE table_name (column_definition [, ...]
[, constraint_definition...])
[ON COMMIT {DELETE | PRESERVE} ROWS]
where:
- MEMORY
- creates the new table in memory. The data for a memory table is held entirely in memory for the duration of the database session. When the database is closed, the data for the memory table is persisted to disk.
- DISK
- creates the new table in on disk. A disk table caches a portion of its data in memory and the remaining data on disk.
- TEMPORARY | TEMP
- creates the new table as a global temporary table. The
GLOBALqualifier is optional. The definition of a global temporary table is visible to all connections. The data written to a global temporary table is visible only to the connection used to write the data. - table_name
- specifies the name of the new table.
- column_definition
- specifies the definition of a column in the new table. See Column Definition for Local Tables for a complete explanation.
- constraint_definition
- specifies constraints on the columns of the new table. See Constraint Definition for Local Tables for a complete explanation.
- ON COMMIT PRESERVE ROWS
- preserves row values in a temporary table while the connection is open; this is the default action.
- ON COMMIT DELETE ROWS
- empties row values on each commit or rollback.
Notes
- If
MEMORY,DISK, orTEMPORARY|TEMPis not specified, the new table is created in memory.