Hello Serge,
Okay here is the details. Im using db2 udb v7.1 for windows.
i have 4 tables lets call them, table1 table2 table3 exception4
table1 and table2 have the same columns as follows
REC_TYPE, EMP_NO, HIRE_DATE, DEPART_ID
However, table1 also has the following columns, GROUP_SRC, EMP_GROUP,
EXEMP, INEMP.
There are all chars except hire_date. Also EXEMP and INEMP are either
'Y' or 'N'
Table3 will be inserted with records which match or not-match through
various join statements with multiple where clauses.
i.e insert into table3(t_REC_Type, t_EMP_NO, effect_date, t_depart_id)
select table1.rec_type....blah balh blah
from table1 inner join table2 on table1.emp_no = table2.emp_no
where (now this is problem #1 i need the records to be insert for the
when EXEMP = 'Y' and INEMP = 'N', or when EXEMP = 'N' and INEMP = 'Y',
or when EXEMP = 'N' and INEMP = 'N, or when EXEMP = 'Y' and INEMP =
'Y') so pretty much the different combination of Y and N for the two
fields.
So how would you write such a statement only once instead of 4 times.
Problem #2 how do you write a stored procedure for this. As this
have to be automated on a monthly basis???
Thanks,
WofD