Por favor, tente desta forma:
foreach($file in dir $CodesetBulkLoadLocation -Recurse -Include @("*.csv"));
{
#$files = @{
#'ICD10' = @{ 'EDIT_FUNCTION'='UCM-REPT-TEEN-PREG-DIAG'; 'TABLE_FUNCTION'='UCM-REPT'; 'CODE_FUNCTION' = 'I0' }
#}
#foreach($file_desc in $files.GetEnumerator())
#{
$filename = $file_desc.Key
$edit_func = $file_desc.Value.EDIT_FUNCTION
$table_func = $file_desc.Value.TABLE_FUNCTION
$code_func = $file_desc.Value.CODE_FUNCTION
$filePath = "C:\jobs\AA\DEV6\UCM\${filename}.csv"
$importFile = Import-CSV $filePath
foreach($item in $importFile)
{
$proc1 = $item.DIAG_NBR
$proc2 = $item.DIAG_NBR
# $ymdeff = $item.YMDEFF
#$ymdend = $item.YMDEND
#$ymdtrans = $item.YMDTRANS
Write-Verbose "$proc1, $proc2"
$currentDate = Get-Date -Format yyyyMMdd
# *******************************************************************************
# * Insert codes and fees into the su_edit_detail.
# *******************************************************************************
'{0,-60}{1,20}' -f "Insert TEEN PREGNANCY ICD9 AND ICD10 CODES into the su_edit_detail ",(Get-Date -Format yyyyMMdd:hhmmss);
$myQuery = @"
SET PAGES 600;
SET LINES 4000;
SET ECHO ON;
SET serveroutput on;
WHENEVER sqlerror exit sql.sqlcode;
insert into SU_EDIT_DETAIL(EDIT_FUNCTION, TABLE_FUNCTION, CODE_FUNCTION, CODE_TYPE,CODE_BEGIN, CODE_END, EXCLUDE, INCLUDE_X, OP_NBR, TRANSCODE, VOID, YMDEFF, YMDEND, YMDTRANS)
select '$edit_func','$table_func','$code_func','DIAG','$proc1','$proc2',' ',' ','MIS', 'C',' ',20141001, 99991231, 20131120
from dual where not exists(select * from SU_EDIT_DETAIL where (EDIT_FUNCTION = '$edit_func' and TABLE_FUNCTION = '$table_func' and CODE_BEGIN='$proc1' and CODE_END='$proc2'));
commit;
"@
$null = Invoke-SqlPlus -MessageOnFail 'Insert into su_edit_detail failed' -Query $myQuery;
}
}
}