Passing output parameter(Oracle) to variable in ksh Script

Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Passing output parameter(Oracle) to variable in ksh Script
# 1  
Passing output parameter(Oracle) to variable in ksh Script


I have researched and tried many way to pass OUT parameter to be stored in variable in KSH Script.Still not success, please help.

Here is my Store Procedure.
create procedure testout3(v_in varchar2,v_out OUT integer)
v_out := 1;

Here is my testvout.ksh
vvarr=$(sqlplus -s username/password<<!EOF

v_out integer;


execute testout3('test',:v_out);




echo $vvarr

Note: I have added "echo $vvarr" to check that the variable is passed or not.

After I run this command below, there is nothing happened, no error , no show data.

# 2  
I am no expert in things SQL, so i am not sure if this SQL-script does what i think it does or something different:

As i read it your stored procedure sets a certain variable to the value "1". In Korn shell, when you assign a variable with a process' outcome like in:

var=$( command )

then the variable is assigned with the output of the command, not its variables. So, if your stored procedure only changes the variables value but has no output, then the ksh-variable will be empty - as the output is empty.

I hope this helps.

Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #577
Difficulty: Medium
If a language offers automated memory management, it is not possible to have memory leaks and other memory allocation issues.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing variable from file to Oracle

cat a1 scott robert tom test script : #!/usr/bin/ksh for NAME in `cat a1` do VALUE=`sqlplus -silent "nobody/bobody01@testq" <<END set pagesize 0 feedback off verify off heading off echo off select username from dba_users where username=upper('$NAME'); END` if ; then echo... (3 Replies)
Discussion started by: jhonnyrip
3 Replies

2. AIX

Oracle output to an array variable in script

Hi- I am returning output of an query into a array variable in my shell script. set -A DATE_RANGE `sqlplus -s **/**@** << EOF set termout off set echo off set serveroutput off set pagesize 0 set linesize 500 set heading off set verify off set feedback off select... (1 Reply)
Discussion started by: vputtas@gmail.c
1 Replies

3. Shell Programming and Scripting

Passing parameter filled variable to a script.

Say I have something like this to try and build a parameter string: OPT1="This is my Option"; OPT2="/folder/file"; PARMS="-u me -J \"$OPT1\" -g \"$OPT2\""; ./script.ksh -n 1 $PARMS; ./script.ksh -n 2 $PARMS; ./script.ksh -n 3 $PARMS; ./script.ksh -n 4 $PARMS; But this doesn't work. ... (2 Replies)
Discussion started by: Devyn
2 Replies

4. Programming

Oracle Variable Passing Test

Hi, I am trying to get the oracle variables and pass the values in sql placed in procedure. VARIABLE vstat='ASDS,FGDS,VCGD,VCXC' Query : select distinct dept from College where section in ('C','D') AND CODES ='' AND NAMES IN ('RAJ','SAM'); I want CODES values to be taken from vstat... (1 Reply)
Discussion started by: Perlbaby
1 Replies

5. Shell Programming and Scripting

Passing parameter to script, and split the parameter

i am passing input parameter 'one_two' to the script , the script output should display the result as below one_1two one_2two one_3two if then echo " Usage : <$0> <DATABASE> " exit 0 else for DB in 1 2 3 do DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}` done fi (5 Replies)
Discussion started by: only4satish
5 Replies

6. Shell Programming and Scripting

Passing value of variable in KSH

Here is a sample script demonstrating the issue x() { echo "foo" a=1 } ## the value of $a is 1 a=0 x echo $a ## the value of $a stays 0 a=0 x|sed "s/foo/bar/" echo $a Result: foo 1 (1 Reply)
Discussion started by: pbmarvin56
1 Replies

7. UNIX for Dummies Questions & Answers

Help Passing An Oracle parameter to a unix shell.

I have an Oracle concurrent program that I'm passing a parameter to a unix shell script. An example value of the Oracle parameter is PO_TOP. The Oracle parameter represents the unix env var PO_TOP, meaning, on the unix side there is env var called PO_TOP (ex value: /oradev/apps/po/11.0.3/). My... (7 Replies)
Discussion started by: Mark_Wright
7 Replies

8. Shell Programming and Scripting

passing variable to oracle procedure

using the script below I want to pass a parameters thorugh my sql call(@/unixsxxx/xxxx/helpenv.sql emptab ) as input into an oracle procedure xxxx_package.proc1(%1,emptab); . I tried %1 but it does not work. Any suggestions. #!bin/ksh set -x # export... (0 Replies)
Discussion started by: TimHortons
0 Replies

9. Shell Programming and Scripting

passing parameter to ftp script from output of another ftp

Hi, I have a ftp script which first gets all the file names and echo's the latest file. I'm using another ftp command sets to get the file name given by first ftp. The problem is the parameter is not accepted by second ftp. The error message i'm getting is > Rename Temp File calloc:ICMP... (5 Replies)
Discussion started by: ammu
5 Replies

10. Shell Programming and Scripting

Strange parameter passing problems (KSH)

Hi all, I'm having a rather peculiar problem involving parameter passing with declared functions in my shell script. Hope to get some advice here. A brief description of my code is as follows: However, I'm not getting the results I wanted. If I pass in $rdir, I'm going to end up... (4 Replies)
Discussion started by: rockysfr
4 Replies

Featured Tech Videos