Sponsored Content
Full Discussion: Pass variable to sql
Top Forums Shell Programming and Scripting Pass variable to sql Post 302339660 by aigles on Friday 31st of July 2009 05:48:08 AM
Old 07-31-2009
If your sql file contains reference to variable of your script, you can do something like in this example :
$ cat ev.sh
eval text=\"$(<ev.txt)\"
cat <<EOD
$ cat ev.txt
Value of variable my_var is ${my_var}  
$ ./ev.sh
Value of variable my_var is Magic 


10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to pass enviroment variable from csh to Informix sql script

Hello, I have a csh script that creates an environment variable. I want to pass the environment variable(CURR_TABLE_DATE) to an Informix sql script. Here is the csh: #!/bin/csh -f setenv INFORMIXSERVER market3_tcp setenv CURR_TABLE_DATE 20090714 set DATABASE = gm_cdr set SQL_DIR =... (0 Replies)
Discussion started by: jwoj
0 Replies

2. Shell Programming and Scripting

Pass a variable to SQL script

Hi Guys, I like to pass a variable to a sql file in a unix script.. I tried a below code.. var=200903 db2 -vf test.sql 200903 test.sql is as below. select * from db2.users where quarter = $1; Please tell me where i go wrong.. Thanks in advance, Magesh (2 Replies)
Discussion started by: mac4rfree
2 Replies

3. Shell Programming and Scripting

how to pass a variable to an update sql statement inside a loop

hi all, i am experiencing an error which i think an incorrect syntax for the where clause passing a variable was given. under is my code. sqlplus -s ${USERNAME}/${PASSWORD}@${SID} << END1 >> $LOGFILE whenever sqlerror exit set serveroutput on size 1000000 declare l_rc ... (0 Replies)
Discussion started by: ryukishin_17
0 Replies

4. Red Hat

How to pass value of pwd as variable in SED to replace variable in a script file

Hi all, Hereby wish to have your advise for below: Main concept is I intend to get current directory of my script file. This script file will be copied to /etc/init.d. A string in this copy will be replaced with current directory value. Below is original script file: ... (6 Replies)
Discussion started by: cielle
6 Replies

5. Programming

pass value from Oracle sql to Korn shell

Hi All , I am trying to pass a value from sqlplus to korn shell . There is a table tab1 in Oracle that has a column userdate. I need to pass the userdate to the korn shell . This is what I am doing . VALUE=`sqlplus -silent username/password << END set pagesize 0 feedback off verify off... (14 Replies)
Discussion started by: megha2525
14 Replies

6. Shell Programming and Scripting

How to pass string into sql query?

Hi Gurus, I have a request which needs to pass string into sql. dummy code as below: sqlplus -s user/password@instance << EOF >>output.txt set echo off head off feed off pagesize 0 trimspool on linesize 1000 colsep , select emp_no, emp_name from emp where emp_no in ('a', 'b', 'c'); exit;... (4 Replies)
Discussion started by: ken6503
4 Replies

7. Shell Programming and Scripting

How to pass a shellscript variable to a sql file?

Hi, i wan't to pass a shellscript variable to a sql file. a.sql select $field from dual; the way i am calling this is through sqlplus field_name="sysdate" sqlplus -s username/password@hostname:port/servicename <<EOF @a.sql $field_name EOF (4 Replies)
Discussion started by: reignangel2003
4 Replies

8. Shell Programming and Scripting

How to pass date to SQL server SP?

HI, I am calling a stored procedure to archieve records from the DB based on a date condition. The syntax for the same is as below: shell script - xyz.sh sqlcmd -s<servername> -U <username> -p<password> -I <embedded SQL input file> The contents of the Embedded SQL INput file are... (10 Replies)
Discussion started by: Rahul Raj
10 Replies

9. UNIX for Advanced & Expert Users

To pass one month range in sql script

Hi Guys, i am having .sql script which inserts data from one table to another table based on date condition, i need to pass range on based on how many number of months, for e.g set timing on; whenever sqlerror exit failure; spool myscript.log append accept start_date... (7 Replies)
Discussion started by: rohit_shinez
7 Replies

10. Shell Programming and Scripting

Storing multiple sql queries output into variable by running sql command only once

Hi All, I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise. Eg : Select 'Query 1 output' from dual; Select 'Query 2 output' from dual; I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies
GZEXE(1)						      General Commands Manual							  GZEXE(1)

gzexe - compress executable files in place SYNOPSIS
gzexe [ name ... ] DESCRIPTION
The gzexe utility allows you to compress executables in place and have them automatically uncompress and execute when you run them (at a penalty in performance). For example if you execute ``gzexe /bin/cat'' it will create the following two files: -r-xr-xr-x 1 root bin 9644 Feb 11 11:16 /bin/cat -r-xr-xr-x 1 bin bin 24576 Nov 23 13:21 /bin/cat~ /bin/cat~ is the original file and /bin/cat is the self-uncompressing executable file. You can remove /bin/cat~ once you are sure that /bin/cat works properly. This utility is most useful on systems with very small disks. OPTIONS
-d Decompress the given executables instead of compressing them. SEE ALSO
gzip(1), znew(1), zmore(1), zcmp(1), zforce(1) CAVEATS
The compressed executable is a shell script. This may create some security holes. In particular, the compressed executable relies on the PATH environment variable to find gzip and some other utilities (tail, chmod, ln, sleep). BUGS
gzexe attempts to retain the original file attributes on the compressed executable, but you may have to fix them manually in some cases, using chmod or chown. GZEXE(1)

Featured Tech Videos

All times are GMT -4. The time now is 01:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy