Insert
- Last Updated: May 26, 2016
- 1 minute read
- DataDirect Connectors
- JDBC
- IBM Db2 5.1
- MySQL 5.1
- Progress OpenEdge 5.1
- SAP Sybase 5.1
- Documentation
Purpose
Adds new rows to a table.
Syntax
INSERT INTO TABLE table_name VALUES (expression [,expression]...)
where:
- table_name
- is the name of the table into which you want to insert rows.
- expression
- is a literal, a parameterized array, or null.
Notes
- The following conditions apply for the successful execution of an insert:
- Values for all columns must be specified in order.
- Column lists cannot be used.
- Casts and other functions cannot be used.
- String values must be enclosed in single quotation marks (').
- By default, the driver supports multirow inserts for parameterized arrays. For a multirow insert, the driver attempts to execute a single insert for all the rows contained in a parameter array. If the size of the insert statement exceeds the available buffer memory of the driver, the driver executes multiple statements. This behavior provides substantial performance gains for batch inserts.
- The driver modifies the HQL statement to perform a multirow insert. Therefore, the
default multirow insert behavior may not be desirable in all scenarios. You can disable
this behavior by setting the BatchMechanism connection property to
nativeBatch. WhenBatchMechanism=nativeBatch, Hive's native batch mechanism is used to execute batch operations, and an insert statement is executed for each row contained in a parameter array.