crystalhelp
Programmer
This is a short example of my code:
insert into table3(a,b,c,d,e,f,g)
select h,i,j,null,null,null,k
from table 1
union
select null,null,null,l,m,n,o
from table 2
If I run each insert statement individually, it works. But if I run them together in a union I get the error: ORA-01790: expression must have same datatype as corresponding expression. I double-checked and the datatypes are the same between the 3 tables.
I have isolated the problem. If I put column names in where the nulls are in the second select statement it runs without problem. So, obviosly nulls aren't allowed in the second select statement. But I want nulls inserted in the third table, so how can I write this?
I know this is a weird question, but I've written these type of insert statements in Sybase before, so I'm sure you can in Oracle, I just have to figure out what the trick is.
insert into table3(a,b,c,d,e,f,g)
select h,i,j,null,null,null,k
from table 1
union
select null,null,null,l,m,n,o
from table 2
If I run each insert statement individually, it works. But if I run them together in a union I get the error: ORA-01790: expression must have same datatype as corresponding expression. I double-checked and the datatypes are the same between the 3 tables.
I have isolated the problem. If I put column names in where the nulls are in the second select statement it runs without problem. So, obviosly nulls aren't allowed in the second select statement. But I want nulls inserted in the third table, so how can I write this?
I know this is a weird question, but I've written these type of insert statements in Sybase before, so I'm sure you can in Oracle, I just have to figure out what the trick is.