Sql Loader returns Null value even after loading the data.

Welcome Forums General PowerShell Q&A Sql Loader returns Null value even after loading the data.

This topic contains 3 replies, has 2 voices, and was last updated by

 
Keymaster
7 months, 2 weeks ago.

  • Author
    Posts
  • #96761

    Participant
    Points: 0
    Rank: Member

    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

  • #96776

    Keymaster
    Points: 1,619
    Helping HandTeam Member
    Rank: Community Hero

    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?

  • #97475

    Participant
    Points: 0
    Rank: Member

    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.

  • #97478

    Keymaster
    Points: 1,619
    Helping HandTeam Member
    Rank: Community Hero

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

The topic ‘Sql Loader returns Null value even after loading the data.’ is closed to new replies.