05-26-2016
You can do this in a few ways.
- You can call sqlplus and pass it a deck/file of multiple SQL commands.
- You can call sqlplus in what is called a here document and pass in the commands from your script
- Probably others......
How much SQL code are you planning to pass in, and will it be static or based on variables in the main script?
Robin
This User Gave Thanks to rbatte1 For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I new to Unix and scripting. Following is my requirement. Can someone tell me whether its possible or not. Also please let me know how to proceed further if this is possible.
List of queries are stored in a file. For example, I have to run a query like this:
Select * from &XYZ where... (0 Replies)
Discussion started by: simhasuri
0 Replies
2. Shell Programming and Scripting
Hi,
When i execute the below statement , the value is not getting stored in the variable.
AnneeExercice=`sqlplus $LOGSQL/$PASSWORDSQL << FIN >> $GEMOLOG/gemo_reprev_reel_data_ventil_$filiale.trc
SELECT bi09exercice
FROM bi09_scenario
WHERE bi09idfiliale=UPPER('de')
AND ... (1 Reply)
Discussion started by: krishna_gnv
1 Replies
3. Shell Programming and Scripting
Hi,
I need your help in sedning sql queries output to different excel sheets.
My requirement is like this:
Query1: Select name from table1 where status = 'Complete'
Query2: Select name from table1 where status = 'Failed'
Query3: Select name from table1 where status = 'Ignored'
... (4 Replies)
Discussion started by: parvathi_rd
4 Replies
4. Shell Programming and Scripting
i have to do a check in my UNIX script to see whats saved in the database. depending on whats there will fork data to certain functions. However i do not know how to capture SQL output into a UNIX variable.
Below is what i have tried, but i get an error:
Error 3706 Failure 3706 Syntax error:... (3 Replies)
Discussion started by: purplebirky
3 Replies
5. Shell Programming and Scripting
Hi,
I want to write the shell script to change multple file name (the file name is get from DB)
e.g. cp db1.txt file1_new.txt
cp db2.txt file2_new.txt
cp db3.txt file3_new.txt
I have write the script like this:
VAR=`sqlplus -s $LOGON @<<ENDOFTEXT
set termout off
... (0 Replies)
Discussion started by: jackyntk
0 Replies
6. Shell Programming and Scripting
In c:/zaheer/123-456/sql/ folder i have below 7 sql files.
cv_abc_a.sql
cv_abc_b.sql
cv_abc_c.sql
vtemp_d.sql
vtemp_e.sql
cv_abc_f.sql
Exviews.sql
In Exviews.sql file i have mentioned all cv and vtemp files to run like
start ${SQLDIR}/cv_abc_a.sql
start ${SQLDIR}/cv_abc_b.sql... (1 Reply)
Discussion started by: Zaheer.mic
1 Replies
7. Shell Programming and Scripting
Hi!
I would like to do a single connection to sqlplus and execute some querys.
Actually I do for every query one connection to database
i.e
echo 'select STATUS from v$instance;
exit' > $SQL_FILE
sqlplus user/pass@sid @$SQL_FILE > $SELECT_RESULT
echo 'select VERSION from v$instance;... (6 Replies)
Discussion started by: guif
6 Replies
8. Shell Programming and Scripting
Hi,
I have a script where I make a sqlplus connection. In the script I have multiple sql queries within that sqlplus connection. I want the result of the queries to be stored in shell variables declared earlier. I dont want to use procedures. Is there anyway else.
Thanks in advance..
Cheers (6 Replies)
Discussion started by: gonchusirsa
6 Replies
9. Shell Programming and Scripting
Dear All,
I am trying to write a Unix Script which fires a sql query. The output of the sql query gives multiple rows. Each row should be saved in a separate Unix File.
The number of rows of sql output can be variable. I am able save all the rows in one file but in separate files.
Any... (14 Replies)
Discussion started by: Rahul_Bhasin
14 Replies
10. Shell Programming and Scripting
Hi All,
I have a file queries.txt as follows :
SELECT COLUMN1 FROM SCHEMA2.TABLE1 MINUS SELECT COLUMN1 FROM SCDEMA2.TABLE2;
SELECT COLUMN2 FROM SCHEMA2.TABLE1 MINUS SELECT COLUMN2 FROM SCDEMA2.TABLE2;
SELECT COLUMN3 FROM SCHEMA2.TABLE1 MINUS SELECT COLUMN3 FROM SCDEMA2.TABLE2;
SELECT... (2 Replies)
Discussion started by: SriRamKrish
2 Replies
LEARN ABOUT DEBIAN
dh-autoreconf
DH-AUTORECONF(7) dh-autoreconf DH-AUTORECONF(7)
NAME
dh-autoreconf - debhelper add-on to run autoreconf during build
DESCRIPTION
The dh-autoreconf package provides a sequence addon for debhelper 7 which can be used in the following way:
#!/usr/bin/make -f
%:
dh $@ --with autoreconf
This will call dh_autoreconf prior to dh_auto_configure and will call dh_autoreconf_clean before dh_clean.
For more information on how to control the autoreconf process or how to other possible options, read the dh_autoreconf(1) and
dh_autoreconf_clean(1) manual pages.
CDBS INTEGRATION
This package also provides /usr/share/cdbs/1/rules/autoreconf.mk for packages using CDBS. The variable "DEB_DH_AUTORECONF_ARGS" can be used
to pass extra arguments to dh_autoreconf, and the variable "DEB_DH_AUTORECONF_CLEAN_ARGS" to pass arguments to dh_autoreconf_clean. See
their manual pages for information on available arguments.
TIPS AND EXAMPLES
PATCHING LTMAIN.SH FOR AS-NEEDED LINKER FLAGS
You can add support for -Wl,--as-needed to ltmain.sh (at least for those ltmain.sh scripts changed during autoreconf) by passing the
argument --as-needed to dh_autoreconf, as demonstrated in the following example:
#!/usr/bin/make -f
%:
dh $@ --with autoreconf
override_dh_autoreconf:
dh_autoreconf --as-needed
and for CDBS, by adding it to the correct variable such as:
DEB_DH_AUTORECONF_ARGS = --as-needed
For more information about this feature, see dh_autoreconf(1)
RUNNING MULTIPLE COMMANDS WITH DH_AUTORECONF
Please note that you may run dh_autoreconf only once. If you need to run multiple commands, you can put the commands into a script or your
debian/rules file and then pass the name of your script to dh_autoreconf. For example, if your script is called debian/autogen.sh, you can
put the following into your debian/rules if you use dh:
override_dh_autoreconf:
dh_autoreconf debian/autogen.sh
Or, if you use CDBS:
DEB_DH_AUTORECONF_ARGS += debian/autogen.sh
CAVEATS
dh_autoreconf is a superset of the autotools-dev debhelper addons, so you do not need --with=autotools_dev if you use --with=autoreconf. In
fact, in most cases they should not be used together, as it may lead to unpredictable behaviour.
From time to time, there might be a short breakage for those using automatic ltmain.sh patching, when the patch now longer applies to the
ltmain.sh.
You can only run dh_autoreconf once. Future versions may be able to be run multiple times, but this requires slightly more planning.
SEE ALSO
debhelper(7), dh(1), dh_autoreconf(1), dh_autoreconf_clean(1)
AUTHOR
Julian Andres Klode <jak@debian.org>
dh-autoreconf v7 2012-11-22 DH-AUTORECONF(7)