Sql Loader returns Null value even after loading the data.

Hi,

We have a program which will load the csv file data using Oracle Sql Loader from powershell. The below is the command which we are using.

$params = Dinesh@TESTDB/Test123* control=D:\Dinesh\workfolder\daily_load\sqlLoader\run_daily.ctl log=D:\Dinesh\workfolder\sqlLoader\run_daily_20180315.txt.log.20180322090844 direct=false rows=1000 errors=0

$exitCode = (Start-Process -wait -PassThru -NoNewWindow sqlldr -argumentlist $params).ExitCode

The issue is, when we are executing this command in our Production environment, it returns the exit code as Null even though the data loaded successfully into the table.
But it should return the exit code as 0. Whereas in our QA environment, we executed with same csv file and same code and its returning the exit code as 0 which is correct.
(The control file and )

As its seems to be environment issue, we rebooted our server and did everything but still we are getting the same issue. (exit code as null)
We should get the exit code as zero.

Can anyone suggest how could resolve this issue.

Thanks in Advance,
Dinesh Kumar

I’m not sure this is really a PowerShell problem; PowerShell just captures whatever code is returned by the external executable. Have you tested the return code in your production environment by manually running the command, versus calling it from PowerShell?

Hi Don Jones,

we executed below command from command prompt and the process went fine but we didn’t see any return code in that.

Start-Process -wait -PassThru -NoNewWindow D:\kumar\Client\horz.exe -ArgumentList D:\Dinesh\Client\prod.job

For getting the exit code, we used .exitcode at the end but its failed.

(Start-Process -wait -PassThru -NoNewWindow D:\kumar\Client\horz.exe -ArgumentList D:\Dinesh\Client\prod.job).exitcode

Can you suggest is there any other way to get the return code from command prompt.

No. If the executable isn’t setting a return code there’s nothing you can do.