Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bulk insert.

Status
Not open for further replies.

lovekang

Programmer
Feb 16, 2006
86
KR
I have two tables with the same stucture, one difference is the name of them.

how can I copy data from tableA to tableB?

is there a query like;
insert into tableB values (*) select * from tableA?

I NEED A QUERY STATEMENT.

Thanks.
 
as in SQL Server like;
INSERT INTO TABLE2 SELECT * FROM TABLE1
 
lovekang,

the syntax is exactly as sql server.
Run the following code

Code:
CREATE TABLE lovekang
      (
	  dummy1 VARCHAR2(10)
	  );

--Make a copy of lovekang
CREATE TABLE LOVEKANG2 AS SELECT * FROM LOVEKANG;
	  
INSERT INTO lovekang VALUES ('lovekang1');
INSERT INTO lovekang VALUES ('lovekang2');
INSERT INTO lovekang VALUES ('lovekang3');

SELECT * FROM lovekang2;

INSERT INTO lovekang2 SELECT * FROM lovekang;
COMMIT;

SELECT * FROM lovekang2;

DROP TABLE lovekang2;
DROP TABLE lovekang;

As you will see from the select statement, after the insert, you will get three rows returned. QED.

Regards

Tharg

Grinding away at things Oracular
 
Thanks.
I was confused by something at that time.
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top