Hi,
We're using Oracle 11.1.0.7.
I need to load a file into a variable and insert it into an Oracle db.
We want to capture the OS file name with the date in it (eg. 'fillename_12152010.txt'), parse out the date in the file name and load that in to an oracle table using a shell script.
I'm looking for the easiest way to do this using SQL.
This is the best I came up with was the following. It's just a proof of concept script.
I'm just trying to pass a variable value into SQL from the shell script.
I can't get it to work.
As you can see I've 'rigged' it from an example I've copied.
I'm having problems with storing the file name I found into a variable that can be passed into SQL*.
How can I manipulate the 'var' variable to read the 'ls' data?
Anybody?
echo $PROGRAM_NAME - get
export user="scott"
export pass="tiger"
export var="$1"
ls *tcebbx1.sh > var
echo $var
#> var
sqlplus -S $user/$pass@ARAD1 <<EOF
SELECT $var FROM dual;
SELECT 'Chicago' FROM dual;
--SELECT * FROM tableName WHERE username=$var;
exit;
EOF
* All logins, passwords and database names have been changed because it's just plain common sense.