ABAP HANA 7.51: INSERT with SELECT
With new ABAP, it is now possible to INSERT in a database table by SELECTing and INSERTing together in one statement.
- INSERT statement is followed by an immediate SELECT statement. SELECT statement can be any valid SELECT statement and can vary from a simple select to complex SELECT consists of JOINS and UNIONs.
- This strategy can reduce database overhead because it hits database once
Sample Source Code:
“Insert from SELECT
INSERT zdemo_table FROM
It is evident from the above code that SELECTed data is directly inserted into another table ZDEMO_TABLE!
The SELECT query can be complex and can consist of UNION and JOINS. Number, column sequence and type of column selected should be similar to Table to inserted.
Code inserts all records of table DEMO_EXPRESSIONS to table ZDEMO_TABLE