I’m trying to read login cridentials from the command prompt in order to execute a series of SQL*Loader Scripts.
I am able to see that the variable got set using set v_. However, I can’t access the values.
Test File:
@echo off
set /P v_user = Username:
set /P v_pass = Password:
set /P v_db = Database:
ECHO Username: "%V_USER%"
ECHO Password: "%V_PASS%"
ECHO Database: "%V_DB%"
set v_
pause
Actual Result Result:
Username: 1 <-- Input
Password: 2 <-- Input
Database: 3 <-- Input
Username: ""
Password: ""
Database: ""
v_db =3
v_pass =2
v_user =1
Expected Result Result:
Username: 1 <-- Input
Password: 2 <-- Input
Database: 3 <-- Input
Username: "1"
Password: "2"
Database: "3"
v_db =3
v_pass =2
v_user =1
Intended Use:
@echo off
set /P v_user = Username:
set /P v_pass = Password:
set /P v_db = Database:
sqlldr %v_user%/%v_pass%@%v_db% CONTROL='TABLE_T1.ctl' log='logs/TABLE_T1.log' bad='bad/TABLE_T1.bad' skip=1
sqlldr %v_user%/%v_pass%@%v_db% CONTROL='TABLE_T2.ctl' log='logs/TABLE_T2.log' bad='bad/TABLE_T2.bad' skip=1
pause
Remove the spaces around the
=in the set statements:The other alternative is to change the ECHO statements to contain the same number of trailing spaces as the SET statement used between the variable name and
=sign: