I came here and followed him. But the inconsistency in the "Data Order" type caused an error. Below is a description from another answer.
Are the results higher than the sequence of columns in your table? because the oracle is strict in column orders. this example below results in an error:
create table test1_1790 ( col_a varchar2(30), col_b number, col_c date); create table test2_1790 ( col_a varchar2(30), col_c date, col_b number); select * from test1_1790 union all select * from test2_1790;
ORA-01790: expression must have the same data type as the corresponding expression
As you can see, the main cause of the error is to streamline the column mismatch, which is implied by using * as the column list specifier. This type of error can be easily avoided by explicitly entering a list of columns:
select col_a, col_b, col_c from test1_1790 union all select col_a, col_b, col_c from test2_1790; A more common scenario for this error is when you accidentally swap (or shift) two or more columns in a SELECT list:
select col_a, col_b, col_c from test1_1790 union all select col_a, col_c, col_b from test2_1790;
OR if the above does not solve your problem, how about creating ALIAS in columns like this: (the request does not match yours, but in this case it is about how to add an alias to the column.)
SELECT id_table_a, desc_table_a, table_b.id_user as iUserID, table_c.field as iField UNION SELECT id_table_a, desc_table_a, table_c.id_user as iUserID, table_c.field as iField
Anand Varkey Philips Nov 23 '16 at 9:54 on 2016-11-23 09:54
source share