ORA-01790: The expression must have the same data type as the corresponding expression
1、 It's said on the Internet:
If this error occurs, you should first check whether there are connections in SQL: union, unio all, etc. If there are, you need to note that the data types of fields with the same name must be the same.
select a.time from A a union all select b.time from B b where a.name = b.name;
For example, in the above SQL statement, it should be noted that the time fields in A and B may be in the date format and the string format. In short, they may not be in the same format. Be careful.
2、 But let me add
I wrote two SQL statements and used union all to connect.
select a.name a.age from studentTabA a union all select b.name b.age from studentTabB b
The above statement will not report an error, but ORA-01790 will still be reported if it is written as follows
select a.age a.name from studentTabA a union all select b.name b.age from studentTabB b
That is, each SELECT statement inside the UNION Must have the same number of columns 。
Column also Must have similar data types 。
At the same time, the The order of the columns must be the same