UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old August 12th, 2003, 02:13 AM
msetjadi msetjadi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Singapore
Posts: 1 msetjadi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Error message but successfull

Hi

Are there anyone has problem to run sqlplus using here-document?

My script are as follows



#!/bin/sh

echo "I am about to check number of objects in source schema "
`$ORACLE_HOME/bin/sqlplus TXX/TXX@HXXX <<HERE
Set termout off;
Set linesize 500;
Set pagesize 0;
Set verify off;
Set feedback off;
exit;
HERE`

echo "After cehck number of objects in source, the exit code=" $?



When i remove the back ticks(before $oracle_home and after here) , it exits directly without executing -echo "After cehck number....."


When i do not remove the back tiks, i got sqlplus not found error,but the script continues and the output of my echo "After ...." is 127.


Any one encounter this problem before?

Reply With Quote
  #2  
Old August 13th, 2003, 10:35 AM
ctsgnb ctsgnb is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 7 ctsgnb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi

In your version,

a) if you leave the back tiks,
"<<HERE" is understood as being an argument of sqlplus which does not match the name of an existing file.

so "<<HERE" is the unknown file

b) if you remove the back tiks,
then your "exit;" which is basically supposed to be processed by sqlplus is processed by the shell, that is the reason why it exit totally from the execution process, skipping the echo "After check..."

-------------------------------------------------

So I would use a temporary file :

#!/bin/sh

echo "I am about to check number of objects in source schema "

echo "
Set termout off;
Set linesize 500;
Set pagesize 0;
Set verify off;
Set feedback off;
exit; " > temp.sql

$ORACLE_HOME/bin/sqlplus TXX/TXX@HXXX @temp.sql

echo "After check number of objects in source, the exit code=" $?

rm temp.sql
------------------

I hope this help

- Ctsgnb -

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Error message but successfull


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway