Provide input in sqlplus script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Provide input in sqlplus script
# 8  
Old 03-12-2011
Quote:
Originally Posted by LivinFree
This could be written as...
No, it couldn't, and if you read the comments in mine you'll understand why.

Last edited by Corona688; 03-12-2011 at 11:13 PM..
# 9  
Old 03-14-2011
Quote:
Originally Posted by Corona688
No, it couldn't, and if you read the comments in mine you'll understand why.
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.

Quote:
Originally Posted by Bash Man Page
If the redirection operator is <<-, then all leading tab characters
are stripped from input lines and the line containing delimiter. This allows
here-documents within shell scripts to be indented in a natural fashion.
If I'm missing something, please point it out clearly.
# 10  
Old 03-16-2011
Quote:
Originally Posted by Corona688
Code:
sqlplus -s @/mydir/xyz.sql <<EOF
response1
${variable2}
response3
EOF
# The above EOF must be at the BEGINNING of the line!  No spaces in front!

# 11  
Old 03-16-2011
Yes. Did you read my comments?
Quote:
Originally Posted by LivinFree
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
Code:
sqlplus -s @/mydir/xyz.sql <<-EOF
	response1
	${variable2}
	response3
	EOF # Note that these the beginning of each line are tabs, not space characters.

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:
Code:
#! /bin/ksh
cat <<-Marker
	This demonstrates a line with a leading tab
 This demonstrates a line with a leading space
	EOF

# 12  
Old 03-17-2011
Quote:
Originally Posted by LivinFree
Yes. Did you read my comments?


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."
That fixes it. I tried spaces, not tabs.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Using tee command with ablity to provide input for prompts

OS version: RHEL 7.4 Shell : bash I would like to capture command outputs using tee like # yum upgrade | tee yumupgradeLog But, if I use tee command, I cannot respond to prompts like Is this ok : during command execution as shown below. Is there a way I could use tee and still be able to... (4 Replies)
Discussion started by: kraljic
4 Replies

2. Shell Programming and Scripting

Passing Oracle function as file input to sqlplus

Apologies if this is the incorrect forum.There is an issue in the function call I am facing while calling the same from a unix shell scripts. Basically, I want the ref cursor to return values to a variable in sqlpus. The function call is currently saved in a ".txt" file in a unix location. I want... (7 Replies)
Discussion started by: amvip
7 Replies

3. Emergency UNIX and Linux Support

How to provide password for rsync in shell script?

Hi, i want to call the rsync in a shell script so that i can run it in background by passing the password within script itself. Can any one please let me know how can i provide the password in the shell script itself so that rsync will read the password when promted by the script. Its very... (11 Replies)
Discussion started by: Little
11 Replies

4. Shell Programming and Scripting

Can any one provide shell script for this ...

• With this script, users will be able to o Enter into the recycle bin mode. During this mode, all files deleted will be sent to the recycle bin. The recycle bin will be common to all users. o View contents of the recycle bin (his/her file(s) only). o Retrieve a particular file from the recycle... (3 Replies)
Discussion started by: bhavana busetty
3 Replies

5. Shell Programming and Scripting

How to provide auto inputs for a sub-script within a script?

Hi All, I am writing a shell script. #!/bin/bash cat /etc/hosts mkdir -p /var/tmp mount 113.123.35.37:/vol/vol615/syb /var/tmp In above script I am trying to add below predefined script/command (/var/tmp/db_tools) This command in turn ask for user input, which will be always option... (17 Replies)
Discussion started by: madhur.baharani
17 Replies

6. Shell Programming and Scripting

Provide Password using to the application using the shell script

Hello, I have a requirement to shut down and start up my application on different environments (Dev, QA and Prod). I have around 24 servers. I have to login to each server manually for shutinng down the application. I wrote a shell command on each server and I am invoking those shell... (2 Replies)
Discussion started by: GDSR Raju
2 Replies

7. Shell Programming and Scripting

Script to provide percentages?

so i'm have been stifled here inn my attempts at this. i need to calculate an unusual figure. what is the percentage difference between 400 and 3? usually, to get the percentage, you just divide the smaller number by the bigger number. then multiply the answer by 100. in this case... (10 Replies)
Discussion started by: SkySmart
10 Replies

8. Shell Programming and Scripting

Writing a UNIX script from LOG to provide return code.

Folks - Firstly, I do apologize that my first post here is a question. I am quite familiar with UNIX since our application is running on it. We are trying to automate a few things on our end and I am challenged with a task in hand that requires UNIX scripting. I am totally a newbie in UNIX... (4 Replies)
Discussion started by: sk72
4 Replies

9. Shell Programming and Scripting

Please provide me with a KSH script.

Hi frnds Im new to unix. I have an xml like the following: <?xml version="1.0"?> <serviceFeeDetail> <Data> <totalAmount>40</totalAmount> </Data> <serviceFee> <invoiceBillGrpNbr>1</invoiceBillGrpNbr> <serviceFeeLineItem> <billLineNbr>1</billLineNbr> ... (2 Replies)
Discussion started by: balesh
2 Replies

10. Shell Programming and Scripting

provide a user password from a script

Hi all, passwd <username> < /var/adm/passwd.txt cat /var/adm/passwd.txt abcd1234 abcd1234 when I run this from the script, it comes with: New password: It is not able to pick from the location /var/adm/passwd.txt. thanks in advance. (6 Replies)
Discussion started by: solaix14
6 Replies
Login or Register to Ask a Question