Use the INSERT statement to add one or more records into a table.
Example:
Create Table t1 that contains the following data:
obclient> CREATE TABLE t1(c1 int primary key, c2 int);
Query OK, 0 rows affected (0.16 sec)
obclient> SELECT * FROM t1;
Empty set (0.02 sec)
Insert data into a single table: Insert a row of data into Table
t1obclient> INSERT INTO t1 VALUES(1,1); Query OK, 1 row affected (0.01 sec) obclient> SELECT * FROM t1; +----+------+ | c1 | c2 | +----+------+ | 1 | 1 | +----+------+ 1 row in set (0.04 sec)Insert data into a single table: Insert data into a subquery.
obclient> INSERT INTO (SELECT * FROM t1) VALUES(1,1); Query OK, 1 row affected (0.01 sec) obclient> SELECT * FROM t1; +----+------+ | C1 | C2 | +----+------+ | 1 | 1 | +----+------+ 1 row in set (0.01 sec)Insert data into a single table: Include the
RETURNINGsub clause.obclient> INSERT INTO t1 VALUES(1,1) RETURNING c1; +----+ | C1 | +----+ | 1 | +----+ 1 row in set (0.02 sec) obclient> SELECT * FROM t1; +----+------+ | C1 | C2 | +----+------+ | 1 | 1 | +----+------+ 1 row in set (0.01 sec)
For more information on the syntax of the INSERT statement, see the "INSERT" topic in SQL Reference (Oracle Mode).