The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
syntax error in while loop habzone2007 Shell Programming and Scripting 1 05-18-2008 04:31 PM
Error connecting oracle from inside while loop Devesh5683 Shell Programming and Scripting 3 05-13-2008 02:48 AM
For loop statement - catch error lumdev Shell Programming and Scripting 4 09-20-2007 07:50 AM
error in bash script 'if' loop DILEEP410 Shell Programming and Scripting 2 06-06-2007 08:04 AM
Error in for loop? hugow UNIX for Dummies Questions & Answers 3 06-28-2005 03:03 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-05-2007
manu_byc manu_byc is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 3
Unix-Sql Loop error

Hi,

I am getting the error "No matching <<", when i run the below. Is it that we can't execute SQL in a Unix loop. I am executing a SQL in a loop. Is it the EOF is written wrongly.


. /opt/app/wlsconfigv61/domains/profiles/oracleV901.profile
export DBUSER=ecdb01

set -A DBINSTANCE ECDBP01P ECDBP02P ECDBP03P ECDBP04P ECDBP05P ECDBP09P ECDBP10P ECDBP11P ECDBP12P ECDBP13P ECDBP14P ECDBP15P

SQLPLUS=${ORACLE_HOME}/bin/sqlplus

SQL_func()
{
filename=${3}
${SQLPLUS} -s $2/$3@$4 <<EOF
spool /export/home/mpdwwcz/sqlOutput/${filename}
set trimspool on
set heading off
set feedback off
set linesize 2000
set arraysize 4000
set pagesize 0
@/export/home/mpdwwcz/IICP_SH/sqlQuery.sql
spool off
exit
!EOF
exit $?
}

if [ ! -x ${SQLPLUS} ]
then
echo "ERROR: Cannot find ${SQLPLUS}. Set the environment variables ORACLE_HOME etc..."
exit -1
fi

i=0
while [ i -lt 11 ]
do
PASSWD=`/opt/app/cbs/CBSDBSecurity/Scripts/ksh/CBSGetPw ${DBINSTANCE[i]} $DBUSER`

echo "DBINSTANCE Is : ${DBINSTANCE[i]}"
echo "DBUSER Is : $DBUSER"
rm /export/home/mpdwwcz/sqlOutput/${filename}
SQL_func $SQLPLUS $DBUSER $PASSWD $DBINSTANCE[i]
i=`expr i + 1`
done
exit $?
  #2 (permalink)  
Old 02-05-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,643
change !EOF to EOF
  #3 (permalink)  
Old 02-05-2007
manu_byc manu_byc is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 3
still i am getting the error. Is it that we should not run SQL in a loop, as when i remove the SQL from the function and execute as a seperate script, it works
  #4 (permalink)  
Old 02-05-2007
manu_byc manu_byc is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 3
Hey thanks actually it's working.....Thanks a lot
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:45 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0