Sql loader in powershell

jeyaprakash m
jeyaprakash m used Ask the Experts™
on
i'm trying to load data to a database table using flat file using following table, while executing the script i'm getting the ERROR

Scriptlet : SQLLDR USERID = $DB_DETAILS , CONTROL= '$ctl', log= '$LOG_FILE', direct = TRUE

Error SQLLDR : SQL*Loader-500: Unable to open file ($ctl.ctl)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
Commented:
$ctl and $Log_file are PowerShell variables? Then you need to enclose them in double quotes, instead of or in addition to the ticks:
SQLLDR USERID = $DB_DETAILS , CONTROL= "'$ctl'", log= "'$LOG_FILE'", direct = TRUE

Open in new window

because PowerShell interprets single quotes (ticks) as delimiters for "literal strings" (do not change anything), while double quotes allow for variable expansion and subexpression evaluation.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial