![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Running shell scripts from web browser | corleone | Shell Programming and Scripting | 7 | 07-31-2006 11:11 PM |
| unix shell scripts for running on solaris | srini_ibmadmin | UNIX for Advanced & Expert Users | 3 | 06-07-2006 03:28 AM |
| running vendor shell scripts | Javagate | UNIX for Dummies Questions & Answers | 1 | 04-13-2004 02:07 PM |
| Running shell scripts on a remote server | pepintheshort | UNIX for Dummies Questions & Answers | 2 | 07-22-2003 04:20 PM |
| Cron running shell scripts. | cfoxwell | UNIX for Dummies Questions & Answers | 3 | 09-26-2001 11:35 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I've a script that fetches various values from the database as below:
#! /bin/ksh $conn="user/pwd@service_name" `sqlplus -s << $conn EOF1 @xyz.sql @pqr.sql @abc.sql EOF1` The output of the script should generate txt files containing the results from queries which are further manipulated for display / reporting. However, when the scripts executes, Oracle throws an exception SP-0734 : not found .. as against running a direct query within the HERE docs (<< EOF1 EOF1). The same exception doesn't arise when the entire block is assigned to a return variable. Can someone focus on why this shows up? TIA Sirisha |
|
||||
|
Oops.. sorry for that mistake. That's a typo here.. and what i did was what you suggested.. thanx for the correction!
Rather i even tried `sqlplus -s "user/pwd@service_name" <<EOF1 @xyz.sql @pqr.sql @abc.sql EOF1` with the same error.. can you pls think of why the error pops up if the whole thing is not assigned to return variable? Any other suggestions are welcome. Thnx again! |
|
||||
|
That is what you are doing with here document enclosed by <<EOF1 and EOF1. The back ticks return the output of the sqlplus command and then, in your case, attempts to execute it.
If you want to capture the output of sqlplus in a variable or an array, then use the back ticks. Code:
set -A RESULTS_ARRAY `sqlplus -s "user/pwd@service_name" <<EOF1
@xyz.sql
@pqr.sql
@abc.sql
EOF1`
for i in ${RESULTS_ARRAY[@]}
do
echo $i
done
|
|
||||
|
That's pretty clear now! Thank you so much
![]() |
| Sponsored Links | ||
|
|