Entering content frame

Syntax documentation INSERT Statement Locate the document in its SAP Library structure

The INSERT statement is used to insert values into a single database table.

This graphic is explained in the accompanying text

<insert statement> ::= INSERT INTO <table name> <insert column list> <insert source>.

<insert source> ::= VALUES '(' <value> ( ',' <value> )* ')'
                            | <query specification>.

<value> ::= <value expression>
                | <dynamic parameter specification>
                |
NULL.

<insert column list> ::= '(' <column name> ( ',' <column name> )* ')'.

Note

In Open SQL the <insert column list> is not optional.

Caution

You cannot specify string literals as values for CLOB columns. Hex literals are not supported in Open SQL.

Examples

Example

INSERT INTO employees (employee_id, employee_name)
              VALUES (4711, 'John Smith')

Inserting Values. A new row is inserted into the table employees with the values 4711 and 'John Smith' for the columns employee_id and employee_name respectively.

Example

INSERT INTO well_paid_employees (employee_id, salary)
             SELECT employee_id, salary
                            FROM employees
                            WHERE salary > ?

Inserting the Result of a Query.  The employee_idand the salaryof all employees from table employeeswith a salary exceeding a certain value are inserted into the table well_paid_employees.

See also:

 

Value expressions, Table Reference, Query Specification, Dynamic Parameter Specification

 

Leaving content frame