I am using the Properties file to get the DB connection values and below is shell script file.
....
read -p "Please enter start date and end date " para1 para2
source database.prop
for ((i=1;i<=$Dbcount;i++ )); do
sqlplus -S ${user1}/${Password}@${conn} <<EOF &
spool sqlcsvdb_"$i".csv
@squery.sql $para1 $para2
exit;
EOF
done
....
squery.sql file.
....
SET PAGESIZE 50000
SET COLSEP "|"
SET LINESIZE 20000
SET headsep ON
SET FEEDBACK OFF
SET TRIMSPOOL ON
SET TRIMOUT ON
set verify off 
SELECT id|| '|'||date|| '|'|| appid from table where date between '¶1' and '¶2';
exit;
EOF
....
When I execute shell it is not passing the variable values and getting ERROR at line 1:ORA-01722: invalid number error message. Please help me on how to I resolve this and usage of bind variables.
@$para1", but not likely to be the issue.) As you've changed the SQL for posting, are you sure your real version has the single quotes around the substitution variables - and those should be into_date()calls, unless the parameter format allows you use date literals?¶1either, do you actually have&1in your real script? It's hard to tell what you're really doing from this. Setting verify on might shed more light on what's going wrong though. If not then you'll need to give a more realistic example. Changing names and data is fine as long as you do it consistently and legally...