The UNIX and Linux Forums  

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
Shell Script And SQLPLUS maco_home UNIX for Dummies Questions & Answers 6 08-25-2007 01:05 PM
calling sqlplus from within a for loop akosz Shell Programming and Scripting 4 05-03-2007 03:23 PM
Problem while calling Oracle 10g SQLPLUS files ganapati UNIX for Advanced & Expert Users 2 05-01-2007 04:03 AM
SQLplus in Shell scripts trupti_d Shell Programming and Scripting 12 03-16-2007 09:46 AM
connect to sqlplus from shell aya_r Shell Programming and Scripting 4 02-07-2007 05:52 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-23-2002
suds19 suds19 is offline
Registered User
  
 

Join Date: Oct 2002
Posts: 5
calling sqlplus from shell

Hi All,

I am executing the following code :-

sqlplus -s ${DATABASE_USER} |&
print -p -- 'set feed off pause off pages 0 head off veri off line 500'
print -p -- 'set term off time off serveroutput on size 1000000'
print -p -- "set sqlprompt ''"
print -p -- "SELECT run_command from tmp_run_batch where upper(batch_name) = upper('${PAR_PROGRAM_NAME}');"
read -p RUN_COMMAND
eval print -p -- \""execute dbms_output.put_line(${RUN_COMMAND});"\"
read -p RET_VAL
print -p -- "exit;"


The select stmt given above gives sample output as :-

pack_claims_clas_utils.func_main('$PAR_RUN_DATE','$PAR_RUN_LEVEL','$PAR_EXCLUSIVE_RUN_YN')

And then this package is executed.


The problem that I am facing is how to handle the no_data_found case of the select stmt. . When this case arises then the stmt. "read -p RUN_COMMAND" hangs.

Could you please provide any solution ?

Thanks
Suds
  #2 (permalink)  
Old 10-24-2002
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Not sure if this will help or not - post your version of Sybase if it does not help you.

Sybase FAQ
  #3 (permalink)  
Old 10-24-2002
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
It appears that you're using ksh, or some other modern shell, so you should be able to use the timeout option of read... to be honest, I don't know if it's work in this situation, since it should timeout "when reading from a terminal or pipe" - I don't know if a coprocess is considered a pipe in this case.

In any case, you should be able to say "read -t 30 -p RET_VAL".
If after 30 seconds, nothing happens, read will return code 1, and exit. You can place some code to check the return of read, and act from there.

Good luck!
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:38 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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