I m creating scripts which input multiple value , inside sqlplus script when it prompt/accept
do anybody know how to provide multiple value inside sqlplus script when it prompt.
like,
enter value for first:
enter value for second:
enter value "save file as " :
I m try to provide these values when sqlplus script ask. but provided parameters will be generated from shell script.
If you need to run this non-interactively, you might look into using 'expect'. It can match incoming lines by regular expressions and provide a response. I'm not well-versed in it, but I've seen it do some cool things including completely automated responses based on timeouts and the data it receives.
If this is an Oracle-supplied script, someone else may have solved this already - a quick web search for the script might turn something up.
Also note, if you want some formatting, some shells allow you to add a "-" before the marker to ignore leading tab characters in the here-doc. This could be written as
sqlplus -s @/mydir/xyz.sql <<-EOF
response1
${variable2}
response3
EOF # Note that these the beginning of each line are tabs, not space characters.
Huh? I use that syntax fairly often in bash. I just checked the man page for ksh88 and ksh93 (since there was a reference to ksh by the OP) and they support that syntax as well.
If I'm missing something, please point it out clearly.
My comment in the code tag was a bit nonsensical, admitedly - it should have read "Note that the beginning of each line is a tab character, not space characters."
As I also pointed out, I verified this behavior in bash, pdksh, ksh88 and ksh93. Tabs, not spaces.
Try it for yourself:
#! /bin/ksh
cat <<-Marker
This demonstrates a line with a leading tab
This demonstrates a line with a leading space
EOF