0
votes

I am trying to load few values in Oracle table using SQLLDR command via Command Prompt. I am trying to set a variable to get users put file name which will be accepted in SQLLDR command. I have a Control file (.CTL), a Data file (.txt) however it is throwing error:

SQL*Loader-500: Unable to open file (sqlldrtest.dat)

even though I have mentioned a .txt file as Data file.

This is first time I am using SQLLDR with a variable. I have successfully used SQLLDR command earlier without any variable.

Please can anyone help me in rectifying this error.

My code for .BAT file is:

set /p reportname="Enter Your Report Name: "

SQLLDR USERID=login/password@database CONTROL=%reportname%.CTL, DATA=%reportname%.txt

pause
2

2 Answers

0
votes

Remove the comma after the CONTROL= and make sure to change your password!

If it still doesn't work, please update your post to show the contents of your control file.

0
votes

The problem is with the format of your DATA file. Your data file need to have .dat extension.

Change the extension of your DATA file from .txt to .dat

Your command should look like this -

SQLLDR USERID=login/password@database CONTROL=%reportname%.CTL, DATA=%reportname%.dat