Sponsored Content
Top Forums Shell Programming and Scripting Return value inside isql to a shell variable in ksh Post 302826995 by DGPickett on Thursday 27th of June 2013 05:14:34 PM
Old 06-27-2013
Well, isql talks to stdout, so write a script in isql using SQL SELECT or PRINT if available, process stdout with something like sed to extract it, and run it. Usualy isql has too much junk around the data to allow you to execute isql output without cleaning. Write what you toss in the log or stderr so you can see error messages.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

return variable from PL/SQL procedure to shell

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

ksh: A part of variable A's name is inside of variable B, how to update A?

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

Setting value of Shell variable from within ISQL

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

How to use substr to return data into a shell script variable?

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

Setting variable for query using iSql / Korn Shell

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

Return Awk Variable to Shell

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

How to assign record count output of isql to a shell variable ?

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

Not able to store command inside a shell variable, and run the variable

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

KSH SHELL: problem calculation number of lines inside compressed file

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

how to use shell variable in isql

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
fisql(1)							 FreeTDS Utilities							  fisql(1)

NAME
fisql - interactive SQL shell SYNOPSIS
fisql [-e] [-F] [-g] [-p] [-n] [-v] [-X] [-Y] [-a display_charset] [-c cmdend] [-D database] [-E editor] [-h headers] [-H hostname] [-i inputfile] [-I interfaces_file] [-J client_charset] [-l login_timeout] [-m errorlevel] [-o outputfile] [-P password] [-s colseparator] [-S server] [-t timeout] [-U username] [-w width] [-y sybase_dir] [-z language] DESCRIPTION
fisql is very similar to the "isql" utility programs distributed by Sybase and Microsoft. Like them, fisql uses the command "go" on a line by itself as a separator between batches. OPTIONS
-a display_charset The client charset name. Not implemented. -c cmdend Command terminator, defaults to go. -D Database name on the server to use. -e Echo SQL input (usually in outputfile) -E editor Specify an editor to invoke. Defaults to vi. -F FIPS mode ON. Server returns a message (but processes the query anyway) when it encounters a non-standard SQL command. -g Display a brief help message -h headers Number of rows after which to repeat the column headers. Default is once per resultset. -H hostname Hostname of the client machine as it will be told to the server. -I interfaces_file Name of the interfaces or freetds.conf file to use. -i inputfile Name of script file, containing SQL. -J client_charset Not implemented. -l login_timeout How long to wait for the server to acknowledge a login attempt. -m errorlevel For errors of the severity level specified or higher, print only the message number, state, and error level. Below that level, print nothing. -n Suppress line numbers in echoed output. -o outputfile Name of output file, holding result data. -p Prints performance statistics. Not implemented. -P password Database server password. -s colseparator The column separator. Default is space. Shell metacharacters require quoting. -S server Database server to which to connect. -t timeout The query timeout, in seconds. How long to wait for a query to be processed. The default is indefinitely, or as determined by freetds.conf. -U username Database server login name. -v Display version and copyright. -w width How many characters wide to print the output. Defaults to 80. -X Use encrypted login. Not implemented in FreeTDS. -y sybase_dir Sets the SYBASE environment variable. Not used by FreeTDS. -Y Use chained transactions. -z language Name of a language for fisql's prompts and messages. Cf. DBSETLNATLANG. NOTES
fisql is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The -i, -o, and -e options override these, of course. fisql uses the db-lib API provided by FreeTDS. It was first implemented using Sybase's own library and continues to work with it. Before (and after) modifying it, it would be well to test it with Sybase's library to assure compatibility between it and FreeTDS. EXIT STATUS
fisql exits 0 on success, and >0 if the server cannot process the query. fisql will report any errors returned by the server, but will continue processing. In a production environment, this behavior may be insuf- ficiently stringent. To make it extremely intolerant of errors, change the message and error handlers to call exit(3). HISTORY
fisql first appeared in FreeTDS 0.65. AUTHORS
The fisql utility was written by Nicholas S. Castellano <entropy@freetds.org>, who contributed it to the FreeTDS project under the terms of the GPL. BUGS
Requires the GNU readline library. doc 13 November 2011 fisql(1)
All times are GMT -4. The time now is 04:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy