Oracle Database - Insert Statement

Card Puncher Data Processing

About

Sql - Insert in Oracle

Insert into a table or a view and as a view is based on table, insert inserts data into tables.

When the number of values matches the number of column, the column list at the beginning is not required but if the structure of the table changes, it will fail.

All datatype and constraint must be honoured.

Insert Statement

Single table

with Select

INSERT
INTO
NAME_OF_THE_TABLE1
( 
  COLUMN1,
  COLUMN2,
  ...
)
SELECT
  COLUMN1,
  COLUMN2,
  ...
FROM
  NAME_OF_THE_TABLE2

with Single values

INSERT
INTO
NAME_OF_THE_TABLE1
( 
  COLUMN1,
  COLUMN2,
  ...
)
VALUES
(
  VALUES1,
  VALUES2,
  ...
)

Multi-table

See Multitable insert example

INSERT ALL
   WHEN order_total < 1000000 THEN
      INTO small_orders
   WHEN order_total > 1000000 AND order_total < 2000000 THEN
      INTO medium_orders
   WHEN order_total > 2000000 THEN
      INTO large_orders
   SELECT order_id, order_total, sales_rep_id, customer_id
      FROM orders;





Discover More
Card Puncher Data Processing
Oracle Database - Direct (path insert|load) (/*+ APPEND */)

A direct-path insert is also known as: direct load A direct-path insert is a bulk operation which will only bypass redo log generation in three cases : the database is in NOARCHIVELOG mode database...



Share this page:
Follow us:
Task Runner