Output Parameter value not displaying


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Output Parameter value not displaying
# 1  
Old 03-17-2010
Bug Output Parameter value not displaying

Hi all,

Below is my shell script that calls a stored procedure(with output parameter)
I have tried executing this script but it doesn't display the output parameter value. Can anyone help me ? Smilie

Code:
#!/bin/bash
###############################################################################
##  Script      : UpdateBatchNumbers.sh
##  Author      : Speridian
##  Installation: 
##  Created     : 16/03/2010
#
##  Summary     : Calls the StoredProcedure that will divide the entire records in batches
##	Location of this file: In Dev Env:/apps/siebel/DevNew2/siebsrvr/MONTHLY/Working
##  Revision History    
##     Date         Revised By      SIR #       Description of Change
##     --------     ------------------------- ------------- ----------------
###############################################################################
. ./UpdateBatchNumberEnvironment.env

#SHELL_START_TIME=`date`
#SHELL_NAME=`basename $0 | cut -d'.' -f1`
#DATE_VARIABLE=`date +%y%m%d%H%M%S`
#LOG_FILE_NAME=${SHELL_NAME}_${DATE_VARIABLE}.log
#LOG_FILE=${MONTHLY_LOG_FILE_DIR}/${LOG_FILE_NAME}
echo "**************************************************START BATCH NUMBER UPDATE********************************************************" > ${LOG_FILE}

var=`sqlplus -s ${USER}/${PASSWD}@${DATABASE} <<END 
set serveroutput on
SET  HEADING OFF
SET  LINESIZE 500
SET  PAGES 0
SET  RECSEP OFF
SET  VERIFY OFF
SET  SHOWMODE OFF
SET  ECHO OFF
SET  FEEDBACK OFF
SET  SPACE 0
SET TAB OFF
var batchrange char(200)
execute BATCHNUMBERPARAM('EIM_ORG_EXT_XM',16250,:batchrange)
exit;
END
`
echo 'var:'
echo $var


Last edited by Franklin52; 03-17-2010 at 03:49 PM.. Reason: Please use code tags!
# 2  
Old 03-17-2010
Does the sql portion generate any standard output?
# 3  
Old 03-17-2010
While executing the stored procedure in oracle sql developer it gives me the output parameter value. in this case it gives me the out put as

BATCHRANGE = 16251-16256(BATCHRANGE is the output parameter value given in the stored procedure)

the stored procedure gets executed when i call it from the unix shell script but doesn't output me the outparameter value (i.e BATCHRANGE = 16251-16256)
# 4  
Old 03-17-2010
Is the output sent to stdout or stderr?
# 5  
Old 03-17-2010
i need the value of the output parameter from the stored procedure to be displayed in the shell (stdout)
# 6  
Old 03-17-2010
Yes I know, but does the stored procedure display its output on stdout or stderr?
change the statement after the END statement to:
Code:
2>&1`

# 7  
Old 03-17-2010
Thanks ,

I came to know that we cant get the out parameter value stored in a shell variable. I bypassed the output of the stored procedure to a file and read the value from the file. SmilieSmilie. Below is the code

Code:
sqlplus -s ${USER}/${PASSWD}@${DATABASE} << EOF > BatchRange.txt 
SET SERVEROUTPUT ON
SET  HEADING OFF
SET  LINESIZE 500
SET  PAGES 0
SET  RECSEP OFF
SET  VERIFY OFF
SET  SHOWMODE OFF
SET  ECHO OFF
SET  FEEDBACK OFF
SET  SPACE 0
SET TAB OFF
exec SIEBEL.BATCHNUMBERPARAM('EIM_ORG_EXT_XM',16250) 
EOF

# Reading the File and output file content to stdout
while read reslt_line
do
  echo "==>"$reslt_line
done < BatchRange.txt

Savio Chacko

Last edited by Franklin52; 03-17-2010 at 03:49 PM.. Reason: Please use code tags!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Luxadm displaying incorrect LUN parameter...

Hello, I have Solaris 10 running on one of rack server with dual port FC card. Each port of FC card is connected to two switches respectively. I have been trying to test multipathing functionality with one of FC Storage. While I have two storage controllers , each connected to the two switches... (0 Replies)
Discussion started by: linuxfreaker
0 Replies

2. Shell Programming and Scripting

Displaying log file pattern output in tabular form output

Hi All, I have result log file which looks like this (below): from the content need to consolidate the result and put it in tabular form 1). Intercomponents Checking Passed: All Server are passed. ====================================================================== 2). OS version Checking... (9 Replies)
Discussion started by: Optimus81
9 Replies

3. Shell Programming and Scripting

Displaying output in the tabular format

Hi I want to display the following input data into the tabular format as shown in the output. Input.txt: Following jobs are in pending state for more than 10 minutes: JOB_ID JOB_SUBMIT_ID MAHAR 784308 PUNJA 109367 Following jobs are running for longer time: JOB_ID... (1 Reply)
Discussion started by: dats
1 Replies

4. Shell Programming and Scripting

Displaying the output in the tabular Format

Hi, I have a file which contains the data in the below format and need to develop a script which will give the output in the tabular format. Could you please advice me. Folder: Workflow: version . Workflow run status: Workflow run error code: Schedule time: Workflow run type: ... (2 Replies)
Discussion started by: kandi.reddy
2 Replies

5. Shell Programming and Scripting

Passing filename as parameter and displaying the file contents

Hi All, Its extremely urgent regarding the following requirement. I have created few files in a directory. I have write a program in shell scripting such that it prompts for the filename . once the filename is entered,it should print the contents of the file. Can anyone help with... (7 Replies)
Discussion started by: radhi2424
7 Replies

6. Shell Programming and Scripting

script not displaying output correctly

Hi, I am having an issue with my script, ofcourse... I am trying to run commands against a remote server, I am pulling the hostnames or IPs from a file list, then looping thru and running the date cmd. I will be running different cmds just trying to get it working first. The ouput isn't... (2 Replies)
Discussion started by: dfezz1
2 Replies

7. Shell Programming and Scripting

Displaying Output in Columns

I'm writing a script to analyze the logs of an smtp relay machine and I'd like the final output to be displayed in columns showing results from the previous day, week, month, and 45 days. The problem I'm running into is that I can't figure out how to display the columns neatly so there is no... (1 Reply)
Discussion started by: jjamd64
1 Replies

8. Shell Programming and Scripting

Displaying output from df -k in GB instead of KB

Hello all, Code below: echo "Oracle Filesystems" echo "------------------" echo for j in `df -l -k |grep total|grep ora|grep -v storage|grep -v vg00|awk '{print $1}'` do echo $j is `df -l -k $j |grep total|grep ora|grep -v storage|grep -v vg00|awk -F":" '{print $2}'|awk '{print $1}'` KB... (6 Replies)
Discussion started by: LinuxRacr
6 Replies

9. Shell Programming and Scripting

displaying output in a table.

Hello, I've just finished my first script (about displaying open ports on the computer and who opened them) and everything is fine with it but I want to style it a little bit just for the sake of learning how to do this. What I want to do is make the display like the one of ps, for example,... (6 Replies)
Discussion started by: sanchopansa
6 Replies

10. Shell Programming and Scripting

Displaying Script command with output

How do you display the script command for a particular output result? Is there an editor that will allow for an echo or sysout of the script that causes an output result? We have hundreds of lines in the script, which we would like to see along with the output, and don't want to have to put in... (5 Replies)
Discussion started by: JeDi
5 Replies
Login or Register to Ask a Question