1. Add a table that passes the structure and data of another table
CREATE TABLE XTHAME.TAB1 as SELECT * from Dsknow.combdversion
2. If the table exists:
INSERT INTO TAB1 select * from TAB2;
3. In the same table, assign the reference to the A field to the B field:
UPDATE table_name Set B = A;
4. Inserting field data from one table into the field data of another table
Insert into XTHAME.TAB1 (pk_bdversion,vbdcode) select Pk_bdversion,vbdcode from Dsknow.combdversion;
* If alert: ORA-00928: Missing SELECT keyword error
The reason is: here Tab1 (Field1,field2,....) Cannot add single quotation marks
5.4th extends multiple fields of multiple tables, inserting multiple fields of the same table.
INSERT into Xthame. BUTTON (button_id, Button_name, Button_code) Select A.pk_examquest, B.pk_bdversion,a.vquestname from Dsknow. Combdversion B, Dsknow. Rqt_examquest a where a.pk_examquest= ' 1001sx1000000000jobv ' and b.pk_bdversion= ' 1000bdv1000010101001 ';
Refer to the original link : https://www.2cto.com/database/201511/450244.html
Blog is to remember that they are easy to forget things, but also a summary of their work, the article can be reproduced, without copyright. Hope to do their own efforts to do better, we work together to improve!
If there is any problem, welcome to discuss together, code if there is a problem, you are welcome to the great God!
Oracle queries one table for inserting data into another table