06-27-2013
Return value inside isql to a shell variable in ksh
Hello,
I have a shell script where I am doing an isql to select some records. the result i get from the select statement is directed to an output file. I want to assign the result to a Shell variable so that I can use the retrieved in another routine.
e.g.
"isql -U${USER} -P${PASSWD} -S${SERVER} -D${DBNAME}" <<EOF>> output1
select Names from Book
... some error check from the result above...
declare @CustID varchar (50)
select @CustID = Customer ID from Customer
EOF
The CustomerID I retrieved above needs to be passed to a UNIX variable so that I can use it further down after the end of the isql.
I did look at some threads where this was questioned but most of the answers are to retreive the value from selects when doing the isql... such as
SOMEVARIABLE = `isql....
however in the above case the result from the first select would also be passed to SOMEVARIABLE... and if so then how would u extract the values that are specifically needed.
Any ideas would be much appreciated.
Thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
i'm calling a pl/sql procedure which is returning one variable.
i'm trying to assing this value to variable in shell script
the code i wrote is
** in shell script**
var= 'sqlplus user/pass @ret.sql'
echo $var
**
and
variable dum_var number
exec rt_test(:DUM_VAR);
exit;
in... (4 Replies)
Discussion started by: ap_gore79
4 Replies
2. Shell Programming and Scripting
This is what I tried:
vara=${varb}_count
(( vara += 1 ))
Thanks for help (4 Replies)
Discussion started by: pa3be
4 Replies
3. Shell Programming and Scripting
Hi Guys,
Need help. I am using ISQL inside a shell script.
Is there a way to set the value of shell script variable from inside the ISQL code. I do not want to write the results from the SQL to an output file.
Please let me know.
Regards,
Tipsy. (3 Replies)
Discussion started by: tipsy
3 Replies
4. Shell Programming and Scripting
I'm writing a shell script in which I need to be able to pull a portion of the file name out. I'm testing with the following code:
x="O1164885.DAT"
y=`ls -ltr *${x}|awk '{print substr($0,3)}'`
echo ${x}|awk '{print substr($0,3)}'
echo "y="$y
I can echo it to the screen just fine but I... (3 Replies)
Discussion started by: ttunell
3 Replies
5. Shell Programming and Scripting
Hi All-
First time using iSql.
I have 4 query files - some have more than 1 line of sql statements
After a bit of research it appears I can just use the -i command and specify the input file.
Questions:
Does it matter that there are multiple queries in each file? Do I need to have... (3 Replies)
Discussion started by: Cailet
3 Replies
6. Shell Programming and Scripting
I'm a bit stuck in getting variable from awk to shell. I tried searching but most of them showing to assign to shell variable via..
VAR=`echo $line | awk -F: '{print $1}'`
which is correct ofcourse
My problem is multiple assignments of variable like this one. The above solution will give... (10 Replies)
Discussion started by: ryandegreat25
10 Replies
7. Shell Programming and Scripting
isql
select count(*) from Table
eof
How to assign record count output of isql query to a shell variable ? (4 Replies)
Discussion started by: vikram3.r
4 Replies
8. Shell Programming and Scripting
Hi,
I am trying to do the following thing
var='date'
$var
Above command substitutes date for and in turn runs the date command and i am getting the todays date value.
I am trying to do the same thing as following, but facing some problems,
unique_host_pro="sed -e ' /#/d'... (3 Replies)
Discussion started by: gvinayagam
3 Replies
9. Shell Programming and Scripting
Hi Gurus,
I am working with a korn shell script to simplify some operations of calculation number of lines inside compressed file.
The called function (inside a cycle) is the following:
#########################################
# F.ne: CheckCount
#########################################... (3 Replies)
Discussion started by: GERMANICO
3 Replies
10. UNIX for Dummies Questions & Answers
Hi ,
I want to use shell variable in isql.
example..
$ksh ./sudh.ksh "2041qwer"
sudh.ksh is my script passing the perameter "2041qwer"
Code in my script :
===========
$SYBASE/$SYBASE_OCS/bin/isql -I$SYBASE/interfaces -S$OTHRSRVR -U$SYBUSER -P$SYBPASS -w... (1 Reply)
Discussion started by: sudhakarpasala
1 Replies
LEARN ABOUT MINIX
suspend
suspend(1) User Commands suspend(1)
NAME
suspend - shell built-in function to halt the current shell
SYNOPSIS
sh
suspend
csh
suspend
ksh
suspend
DESCRIPTION
sh
Stops the execution of the current shell (but not if it is the login shell).
csh
Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su.
ksh
Stops the execution of the current shell (but not if it is the login shell).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
csh(1), kill(1), ksh(1), sh(1), su(1M), attributes(5)
SunOS 5.10 15 Apr 1994 suspend(1)