Oracle inserts too many data fields

problem description

Table An and Table B have the same field name and number of fields, but the default order of the fields is not the same. Now you need to insert all the data in table An into table B.
use insert into B select * from A, oracle to report an error "ORA-01722: invalid number".
can only use insert into B (col1, col2,col3.) select col1, col2,col3. From A . But Table A has more than 80 fields, so it"s too troublesome to spell it by hand. Do you have any simpler sql?

Apr.25,2021

this is the grammar standard, there is no simplified way.

besides, it is not troublesome to export more than 80 fields into sql statements after being exported from the table definition of the database without the need for manual input one by one.


change the order of fields to be consistent, which generally does not affect your program. Then, it will be too convenient to run into your situation
insert into table1 select * from table2

.
Menu