1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
INSERT INTO tb_cnfbatch@dbl_arch_1 (batch_sn,company_sn,thread_sn,batch_id,batch_param,batch_exec,
batch_date,batch_mode,batch_freq,batch_dern_exec,batch_run,
batch_forced,batch_status,profiling_status,batch_next_exec,
batch_exclusif,batch_db1,batch_db2,batch_type,batch_param2,
batch_param3,batch_param4,batch_param5,batch_debug,batch_global,
batch_to_kill,batch_pid,batch_scheduled,batch_ma_sn_cur)
SELECT batch_sn,company_sn,thread_sn,batch_id,batch_param,batch_exec,
batch_date,batch_mode,batch_freq,batch_dern_exec,batch_run,
batch_forced,batch_status,profiling_status,batch_next_exec,
batch_exclusif,batch_db1,batch_db2,batch_type,batch_param2,
batch_param3,batch_param4,batch_param5,batch_debug,batch_global,
batch_to_kill,batch_pid,batch_scheduled,batch_ma_sn_cur
FROM tb_cnfbatch tb_a
WHERE company_sn = 1
and not exists (SELECT 1
FROM tb_cnfbatch@dbl_arch_1 tb_b
where tb_a.batch_sn = tb_b.batch_sn
and tb_b.batch_sn between (
select min(batch_sn)
from tb_cnfbatch
where company_sn = 1
)
and
(
select max(batch_sn)
from tb_cnfbatch
where company_sn = 1
)
) |
Partager