insert into "DB".edi.I_PICKSLIP_non_MAJ
(
date,
"PICKSLIP_non_MAJ_NUM",
nom_fichier,
pick_slip,
INCREMENTAL_FLAG
)
select
CURRENT_TIMESTAMP AS date,
nextval('edi."PICKSLIP_non_MAJ_PICKSLIP_non_MAJ8NUM_seq"') AS "PICKSLIP_non_MAJ_NUM",
${~/p_File_Name}$ AS nom_fichier,
expedition.c3
AS pick_slip,
'I' AS INCREMENTAL_FLAG
from "DB".edi.expedition AS expedition
LEFT OUTER JOIN "DB".edi.L1_PICKSLIP_non_MAJ AS L1_PICKSLIP_non_MAJ
ON expedition.c3 = L1_PICKSLIP_non_MAJ.L1_pick_slip
where (1=1) AND ( expedition.c3 not in (select pick_slip from work.eb_chargement) )