Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle INSERT INTO Statement

The Oracle INSERT INTO statement permit you to insert one or multiple records into a database table.

Note: Make sure the order of the values is in the same order as the columns in the table.

Oracle INSERT INTO Syntax

To insert the record into the table, use the following syntax:

Syntax

INSERT INTO table_name ( col1, col2,...colN )  
VALUES ( val1, val2,...valN );

Oracle INSERT INTO Syntax for all fields

To insert the record for all the fields into the table, use the following syntax:

Syntax

INSERT INTO table_name VALUES ( val1, val2,...valN );

Oracle INSERT INTO example for all fields

The following Oracle statement to insert all the field values, either specify all field name or don't specify any field name.

Example

INSERT INTO tblCustomerLoan   
VALUES ('Mahesh', 'Malhotra','12-13-2/2A, new Delhi','123456789012','ABCDE3333G',1234567890);

OR

INSERT INTO tblCustomerLoan (firstName, lastName, address, aadharNo,panNo,cellNo)  
VALUES ('Mahesh', 'Malhotra','12-13-2/2A, new Delhi','123456789012','ABCDE3333G',1234567890);

Note:

In the above example, we have inserted new record into the table called "tblCustomerLoan".

Oracle INSERT INTO Syntax for partial fields

It is mandatory to specify field names. To insert the partial fields into the table, use the following syntax:

Syntax

INSERT INTO table_name ( col2, col3, col4)  
VALUES ( val2, val3, val4 );

Oracle INSERT INTO example for partial fields

The following Oracle statement to store partial fields value into the table.

Example

INSERT INTO tblCustomerLoan (address, aadharNo,panNo,cellNo)  
VALUES ('12-13-2/2A, new Delhi','123456789012','ABCDE3333G',1234567890);

Note:

In the above example, we inserted partial record into the table called "tblCustomerLoan".

Oracle INSERT INTO Syntax to insert multiple records

To insert multiple records into the table, use the following syntax:

Syntax

INSERT INTO table_name ( col1, col1, col2)  
VALUES ( val1, val2, val3 ),
	   ( val1, val2, val3 ),
	   ( val1, val2, val3 );

Oracle INSERT INTO example to insert multiple records

The following Oracle statement to store insert multiple records into the table.

Example

INSERT INTO tblCustomerLoan (address, aadharNo,panNo,cellNo)  
VALUES ('12-13-2/2A, new Delhi','123456789012','ABCDE3333G',1234567890),
	   ('A/12, Opp. PVR Cinema, Hyderabad','123456789012','WERTQ3333G',2888888980),
	   ('A-12, Habsiguda, Hyderabad','123456789012','IOUYT3333G',2342323234);

Note:

In the above example, we inserted multiple records into the table called "tblCustomerLoan".