I have a few SQL*Plus scripts in a directory that I would like to run automatically using powershell. I can read the directory and but when I tried to execute the script, the scripts terminated but did not quit powershell and go to the next one.
How do I make powershell quit SQL*Plus and go to the next script automatically without me modifying the scripts by explicitly adding a quit at the end of each script?
Below is the illustrated powershell script in its simplest form
$Filename=Get-childitem "D:estTestSQL" -Filter *.sql | Select -ExpandProperty name
foreach ($f in $Filename)
{
sqlplus -L -S <username>/<password>@<sid> @$f
}
The directory can theoretically contain hundreds of scripts and it is not feasible to add quit command in each script. I would like to force SQL*Plus to quit after completing each script and move on to the next one.
Is it possible to do that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…