0% found this document useful (0 votes)
22 views

Insert From

The INSERT statement is used to add values to a database table by populating a work area with the desired values, then using INSERT to add the work area values to the table. The syntax is INSERT <table> FROM <work area> or INSERT INTO <table> VALUES <work area>. If the primary key matches an existing row, the insert fails with a return code of 4; otherwise it succeeds with a return code of 0.

Uploaded by

Vikram Bigamudre
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Insert From

The INSERT statement is used to add values to a database table by populating a work area with the desired values, then using INSERT to add the work area values to the table. The syntax is INSERT <table> FROM <work area> or INSERT INTO <table> VALUES <work area>. If the primary key matches an existing row, the insert fails with a return code of 4; otherwise it succeeds with a return code of 0.

Uploaded by

Vikram Bigamudre
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

INSERT is the open SQL statement to add values to the database table.

First declare a work area as the line structure of database table and populate the work area with the desired values. Then add the values in the work area to the database table using INSERT statement. The syntax for the INSERT statement is as follows. INSERT <database table> FROM <work area> or INSERT INTO <database table> VALUES <work area> If the database table does not already contain a line with the same primary key as specified in the work area, the operation is completed successfully and SY-SUBRC is set to 0. Otherwise, the line is not inserted, and SY-SUBRC is set to 4.
DATA: gwa_employee TYPE zemployee. gwa_employee-id gwa_employee-name gwa_employee-place gwa_employee-phone gwa_employee-dept_id = = = = = 6. 'MARY'. 'FRANKFURT'. '7897897890'. 5.

INSERT zemployee FROM gwa_employee.

EMPLOYEE table entries before INSERT

EMPLOYEE table entries after INSERT

You might also like