Home » SQL & PL/SQL » SQL & PL/SQL » insert data to two tables
insert data to two tables [message #1267] Mon, 15 April 2002 23:20 Go to next message
lokman
Messages: 1
Registered: April 2002
Junior Member
i want to insert data to two tables, what are the command?
can you help me?
Re: insert data to two tables [message #1268 is a reply to message #1267] Tue, 16 April 2002 01:28 Go to previous message
Mike
Messages: 417
Registered: September 1998
Senior Member
With 9i you can do it like this:

INSERT ALL
INTO sales (prod_id, cust_id, time_id, amount)
VALUES (product_id, customer_id, weekly_start_date, sales_sun)
INTO sales (prod_id, cust_id, time_id, amount)
VALUES (product_id, customer_id, weekly_start_date+1, sales_mon)
INTO sales (prod_id, cust_id, time_id, amount)
VALUES (product_id, customer_id, weekly_start_date+2, sales_tue)
SELECT product_id, customer_id, weekly_start_date, sales_sun,
sales_mon, sales_tue, sales_wed, sales_thu, sales_fri, sales_sat
FROM sales_input_table;
Previous Topic: Calling a Package from a Trigger
Next Topic: change coloumn name
Goto Forum:
  


Current Time: Fri Apr 26 16:04:24 CDT 2024