getting proper o/p from a procedure in a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting getting proper o/p from a procedure in a script
# 1  
Old 08-12-2008
getting proper o/p from a procedure in a script

foll. is my code snippet.

#!/bin/ksh
retVal=`sqlplus -s user/passwd@oracle_sid <<EOF
SET SERVEROUTPUT ON SIZE 100000
DECLARE
STATUS_VALUE CHAR;
BEGIN
SELECT temp1 INTO STATUS_VALUE FROM sai;
DBMS_OUTPUT.PUT_LINE(STATUS_VALUE);
END;
/
SET SERVEROUTPUT OFF
exit;
EOF`
echo $retVal


& the o/p on console is

N PL/SQL procedure successfully completed.

whereas temp1 is a flag...& its value is either Y or N.

My requirement is ...how to get only 'N' or 'Y' in retVal??

i dont want the later part(PL/SQL procedure successfully completed.)

pls HELP. TIA.
# 2  
Old 08-12-2008
If the first token of the output is either N or Y, can't you just ignore the rest?

Code:
case $retVal in Y\ *) echo yes;; N\ *) echo no;; esac
# or
retValReal=${retVal%\ *)  # or %% if your shell has that

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Proper distribution of cards in terminal based crazy8's game in bash script

When I run the following script at the bottom it say cards remaining=44...It should be=35. Can anyone tell me what I'm doing wrong. I've spent hours trying to get this to work and I can't go any further until this part works. thank you in advance Cogiz #!/bin/bash # Date="November, 2016" #... (2 Replies)
Discussion started by: cogiz
2 Replies

2. Shell Programming and Scripting

Sub script calling procedure

Hi, I have a doubt regarding how sub scripts will be executed and interested to know internal workflow, For example - My main script is A,it calls a script B then B will call some C....and so on. Then B script run parallel to A or it will wait B to execute then A will continue. ... (1 Reply)
Discussion started by: nag_sathi
1 Replies

3. Shell Programming and Scripting

Executing procedure using script

Hi, I want to have a automted script to exceute 20 procedures one by one. Suppose below is one procedure once it get executed script will write "PL/SQL procedure successfully completed." to a log for ex- exec dbms_stats.gather_table_stats(); Now later procedure starts executing... (1 Reply)
Discussion started by: sv0081493
1 Replies

4. UNIX for Advanced & Expert Users

why the script is not terminating with proper results

Hi everyone, I am new to the linux.I wrote a small script and assigning two values to fname and lname and I want if the fname or lname are not given proper name like Toys or Gun the script should terminate and if they are given proper name it should execute.please help thanks:wall: #!/bin/bash... (4 Replies)
Discussion started by: starter2011
4 Replies

5. Shell Programming and Scripting

Need help with procedure and parameters in a script

Hi, I'm trying to create a procedure within my script and what I want is something like: myproc () { PARM1=value after -t PARM2=value after -y } myproc -t "PARM1 Value" -y "PARM2 Value" Of course that won't work since there's no such command as "value after -t". But this is... (4 Replies)
Discussion started by: adshocker
4 Replies

6. Shell Programming and Scripting

Getting Proper Date Format in SH Script

There's a small SH script I'm trying to write where it will get the current month and find a log file that is based on the date. Example: Today is February, so the log file is going to be 201102.log (2011 + 02) An additional thing is that if today is the 1st of a month, it will also find the log... (3 Replies)
Discussion started by: kooshi
3 Replies

7. Shell Programming and Scripting

issue invoking shell script using cron, even with proper file permission

I am using tcsh what could possibly be a problem, when using crontab to invoke a shell script. ? The script has the read, write and execute permission to all users. And the script works as expected while executing it in stand-alone mode. Is there a way to trace (like log) what error... (9 Replies)
Discussion started by: vikram3.r
9 Replies

8. Shell Programming and Scripting

calling procedure from script

Hi All, My script will call a storedprocedure #!/bin/bash # # Script for ........... . ../conf/setting.env # Environment file to set the DATABASE #TODAY=`date '+%Y%m%d_%H'` #echo TODAY = $TODAY sqlplus -s $DATABASE <<EOF spool $TRACKING_LOGDIR/CalcFreqPgsVues_H.log exec... (3 Replies)
Discussion started by: scorpio
3 Replies

9. AIX

The shell script is not returning proper result

Can anybody pls look into this script and tell me where I went wrong. After running this script, it is showing like "Trying to overlay current working directory ABORT!!!" :-( ARGCNT=$# if then echo "Two parameters are needed for this shell " echo "Please try again with... (1 Reply)
Discussion started by: clnsharma123
1 Replies

10. UNIX for Advanced & Expert Users

Starting a script from a Database procedure

Hey guys, I have this problem : I can run on an sqlprompt !ftp_file2.ksh test.xml 172.16.204.81 Anonymous Anonymous which will ftp the file from Unix to an NT machine, but if I do exec shell('sh ftp_file2.ksh test.xml 172.16.204.81 Anonymous Anonymous') it does NOTHING. I have no... (4 Replies)
Discussion started by: vidireporting
4 Replies
Login or Register to Ask a Question