How To Do Conditional Insert in Oracle?
Posted on 2014-11-20
I have two tables with names TA and TB. TA has columns a,b,c,d and TB has columns x,y,z,t. I'm going to insert columns x, y, z from TB into TA. However, the remaining column in TA, the column d, will be zero if value of the column t in TB is 'AD' otherwise it will be one.
In other words, something like this:
insert into TA (a,b,c,d) select x,y,z,(0 if t='AD' otherwise '1') from TB;
Could you help me?