Insert Statement (insertStatement)
目的
Inserts data into a table of a data container. Low-volume inserts are typically done one-by-one, but on some connectors a bulk insert option is available which inserts data with multiple rows each time for higher throughput. The data can be sourced from a select statement or values. Values can be single row values or multiple row values.
The list of columns is optional, with values as well as with a select statement. Without it, the values fill the columns of the table in the order in which select * returns them; the number of values must then equal the number of columns, otherwise itgendid109 (too few) or itgendid225 (too many) is raised. A technical column such as rowid$ of InMemoryStorage is filled by the platform and is not part of that list. An insert with values and without a list of columns is available from release 28.0. A statement that names its columns keeps working when a column is added to the table, so naming them is advisable in scripts that last.
With continue on errors the insert goes on after a row which fails, and fails after its last row with one error, itgensql964, which states how many rows failed; see "Continuing After Failed Rows" below.
The identified by and attach to clause can be used in combination with transactions. The identified by clause is used to register the master rows, whereas the attach to clause is used to register which master rows detail rows belong. Upon commit, a master row (such as a sales order) plus it's details (such as multiple sales order lines) are sent to the target data container.
構文
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart TD
insertStatement_start((START))
insertStatement_start --> insertStatement_0_0[BULK]:::quoted
insertStatement_0_0 --> insertStatement_0_1[INSERT]:::quoted
insertStatement_0_1 --> insertStatement_0_2[INTO]:::quoted
insertStatement_0_1 --> insertStatement_0_12[<a href="https://documentation.invantive.com/Invantive UniversalSQL/Execution Hints/Execution Hints" class="internal-link">executionHints</a>]
insertStatement_0_12 --> insertStatement_0_2
insertStatement_0_2 --> insertStatement_0_3[tableSpec]
insertStatement_0_3 --> insertStatement_0_4[insertFieldList]
insertStatement_0_3 --> insertStatement_0_5
insertStatement_0_4 --> insertStatement_0_5[valuesExpression]
insertStatement_0_5 --> insertStatement_0_6[insertFieldList]
insertStatement_0_6 --> insertStatement_0_7[selectStatement]
insertStatement_0_7 --> insertStatement_0_8[identifiedByClause]
insertStatement_0_8 --> insertStatement_0_9[attachToClause]
insertStatement_0_9 --> insertStatement_0_10[BATCHSIZE]:::quoted
insertStatement_0_10 --> insertStatement_0_11[numericConstant]
insertStatement_0_11 --> insertStatement_end((END))
insertStatement_0_11 --> insertStatement_0_13[continueOnErrorsClause]
insertStatement_0_13 --> insertStatement_end
Continuing After Failed Rows
Without continue on errors the first row which fails ends the statement, and the rows written before it stay written. With it, the statement writes every row which can be written:
continue on errorsgoes on after any number of failed rows;continue on first n errorsstops the statement at the failure after the first n withitgensql965;- when the first 100 rows all fail with the same message code before any row succeeded, the cause is taken to be the statement and it stops with
itgensql966; - a cancellation, a temporary failure and a licence error stop the statement at once.
After the statement, SQLROWCOUNT gives the number of rows written, also when the statement failed at the end. The view DmlRowFailures@DataDictionary lists the failed rows of the latest ten statements of the session with their position, message code, message and values, and with the STATEMENT_ID that SessionIOs@DataDictionary shows; the hint result_set_name gives the statement a name to find its rows by.
A bulk insert loses as few rows of a batch as the platform allows. A batch which the platform refuses as a whole, such as on Microsoft SQL Server and PostgreSQL, is sent again in halves until the failing rows are found. Oracle, Invantive Waypoint and the in-memory storage name the failing rows themselves. When a platform does not say which rows of a failed batch it applied, those rows are listed with the outcome unknown and not sent again, so that no row is inserted twice. Exact Online inserts row by row.
Available from the releases of 27.0 and 27.1 built after 1 December 2026.
continueOnErrorsClause
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
continueOnErrorsClause_start((START))
continueOnErrorsClause_start --> continueOnErrorsClause_0_0[CONTINUE]:::quoted
continueOnErrorsClause_0_0 --> continueOnErrorsClause_0_1[ON]:::quoted
continueOnErrorsClause_0_1 --> continueOnErrorsClause_0_2[FIRST]:::quoted
continueOnErrorsClause_0_1 --> continueOnErrorsClause_0_4
continueOnErrorsClause_0_2 --> continueOnErrorsClause_0_3[numericConstant]
continueOnErrorsClause_0_3 --> continueOnErrorsClause_0_4[ERRORS]:::quoted
continueOnErrorsClause_0_4 --> continueOnErrorsClause_end((END))
The following example inserts every row of the in-memory table which Oracle accepts, and then lists the rows which failed:
bulk insert /*+ result_set_name('load_translations') */
into itgen_translations_v@ora
( apn_code
, tln_resource_code
, lge_code
)
select apn_code
, tln_resource_code
, lge_code
from translations_soll@InMemoryStorage
batchsize 1000
continue on errors
select row_ordinal
, message_code
, message_text
, row_values
from DmlRowFailures@DataDictionary
where result_set_name = 'load_translations'
valuesExpression
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
valuesExpression_start((START))
valuesExpression_start --> valuesExpression_0_0[values_]
valuesExpression_0_0 --> valuesExpression_0_1[insertValuesBulk]
valuesExpression_0_1 --> valuesExpression_0_2[insertValues]
valuesExpression_0_2 --> valuesExpression_end((END))
bulk
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> BULK[BULK]:::quoted
BULK --> End((END))
into
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> INTO[INTO]:::quoted
INTO --> End((END))
insert
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> INSERT[INSERT]:::quoted
INSERT --> End((END))
values_
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> values_
values_ -->| | VALUES[VALUES]:::quoted
VALUES --> End((END))
insertFieldList
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
insertFieldList_start((START))
insertFieldList_start --> insertFieldList_0_0["("]:::quoted
insertFieldList_0_0 --> insertFieldList_0_1[columnList]
insertFieldList_0_1 --> insertFieldList_0_2[")"]:::quoted
insertFieldList_0_2 --> insertFieldList_end((END))
insertValuesBulk
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
insertValuesBulk_start((START))
insertValuesBulk_start --> insertValuesBulk_0_0["("]:::quoted
insertValuesBulk_0_0 --> insertValuesBulk_0_1[insertValues]
insertValuesBulk_0_1 --> insertValuesBulk_0_2[","]:::quoted
insertValuesBulk_0_2 --> insertValuesBulk_0_3[insertValues]
insertValuesBulk_0_3 --> insertValuesBulk_0_4[")"]:::quoted
insertValuesBulk_0_4 --> insertValuesBulk_end((END))
insertValues
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
insertValues_start((START))
insertValues_start --> insertValues_0_0["("]:::quoted
insertValues_0_0 --> insertValues_0_1[insertValuesList]
insertValues_0_1 --> insertValues_0_2[")"]:::quoted
insertValues_0_2 --> insertValues_end((END))
insertValuesList
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
insertValuesList_start((START))
insertValuesList_start --> insertValuesList_0_0[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
insertValuesList_0_0 --> insertValuesList_0_1[","]:::quoted
insertValuesList_0_1 --> insertValuesList_0_2[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
insertValuesList_0_2 --> insertValuesList_end((END))
identifiedByClause
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
identifiedByClause_start((START))
identifiedByClause_start --> identifiedByClause_0_0[IDENTIFIED]:::quoted
identifiedByClause_0_0 --> identifiedByClause_0_1[BY]:::quoted
identifiedByClause_0_1 --> identifiedByClause_0_2[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
identifiedByClause_0_2 --> identifiedByClause_end((END))
identifiedByMultipleClause
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
identifiedByMultipleClause_start((START))
identifiedByMultipleClause_start --> identifiedByMultipleClause_0_0[IDENTIFIED]:::quoted
identifiedByMultipleClause_0_0 --> identifiedByMultipleClause_0_1[BY]:::quoted
identifiedByMultipleClause_0_1 --> identifiedByMultipleClause_0_2[columnList]
identifiedByMultipleClause_0_2 --> identifiedByMultipleClause_end((END))
attachToClause
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
attachToClause_start((START))
attachToClause_start --> attachToClause_0_0[ATTACH]:::quoted
attachToClause_0_0 --> attachToClause_0_1[TO]:::quoted
attachToClause_0_1 --> attachToClause_0_2[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
attachToClause_0_2 --> attachToClause_end((END))