SQL query in a loop with single sqlplus connection
Hi,
I'm trying to build a shell script that reads a set of accounts from a file. For each account I need to perform a set of sql queries. So I have a loop with a set of sqlplus connections to retrieved my data.
Is it possible to have a single sqlplus connection before entering the loop and use this connection to the database inside the loop to avoid having to connect every time I need to perform an sql statement?
Currently, the related piece of code I have, is similar to this one:
Many thanks
Last edited by Franklin52; 01-31-2011 at 04:42 AM..
Reason: Please use code tags
Hi to all,
I have a endday.sh file. And I execute this like "sh endday.sh" from command prompt. In endday.sh file it writes:
sqlplus temp/temp@data @run.sql&
echo $!>>pid.txt
However my aim is not to put the pid into pid.txt but I need to insert the pid into an oracle table using sqlplus.... (1 Reply)
Hi to all,
I have a endday.sh file. And I execute this like "sh endday.sh" from command prompt. In endday.sh file it writes:
sqlplus temp/temp@data @run.sql&
echo $!>>pid.txt
However my aim is not to put the pid into pid.txt but I need to insert the pid into an oracle table using sqlplus.... (1 Reply)
Hi to all,
I have a endday.sh file. And I execute this like "sh endday.sh" from command prompt. In endday.sh file it writes:
sqlplus temp/temp@data @run.sql&
echo $!>>pid.txt
However my aim is not to put the pid into pid.txt but I need to insert the pid into an oracle table using sqlplus.... (1 Reply)
Hi All,
I needed to get the result of two sqlplus queris into shell variables.
After days of looking for the ultimate solution to this problem.. i found this...
sqlplus -s USER/PASS@DB <<EOF | awk '{if(NR==1) printf("%s ", $1); if(NR==2) printf("%s ",
$1);}' | read VAR1 VAR2
set head off... (2 Replies)
Is there anyway to spool my select statement into spool files of max 10000 records each?
eg I have a select statement that will return 45000 records.
A normal spool command will output the 45000 into just one spool file.
How can I make sqlplus do this?
00001 - 10000 records --- spool... (3 Replies)
Hi,
I am using sqlplus query to get results in a csv format in unix. I am using ksh, and below is the query.
echo "select r.num|| ',' || p.path ||',"' || r.issue_description ||'",' ||p.timestamp from events r, messagepath p;">> $QUERY_FILE
sqlplus -s $LOGIN @ $QUERY_FILE>>$OUTFILE
... (2 Replies)
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)
Hi,
Could someone tell me how to stop SQLPLUS command from printing the connection details in the console.
Below is the lines i get in console when executing the sqlplus...
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 9 03:31:03 2011
Copyright (c) 1982, 2005, Oracle. All rights... (2 Replies)
I need to connect a databas eusing sqlplus and i need to store the results of each query in separate file.
is it possible to achieve this usng single sqlplus?
i dont want to connect each time for each query.
thanks (3 Replies)
Hello ,
Im calling every single file inside my script like 1.sql,2.sql so on it looks so tedious. I want to replace with for loop where every file gets executed. When i use for loop im getting errorUnexpected EOF] , can anyone please help me out in this..
How i can use for loop to invoke my... (6 Replies)
Discussion started by: preethi87
6 Replies
LEARN ABOUT DEBIAN
cvm-mysql
cvm-mysql(8) System Manager's Manual cvm-mysql(8)NAME
cvm-mysql - MySQL module
SYNOPSIS
cvm-mysql
CREDENTIALS
Pass phrase
DESCRIPTION
This module queries a MySQL database for the account name, compares the stored pass phrase with the given one using crypt(3).
CONFIGURATION VARIABLES
CVM_MYSQL_DEFAULT_FILE
The full path of the defaults file to read if the following variable is set. If not set, the file $HOME/.my.cnf will be read (the
MySQL default).
CVM_MYSQL_DEFAULT_GROUP
If set, the module will read connection default options from the named group in the defaults file as above
CVM_MYSQL_HOST
The hostname or IP of the MySQL server. If not set, a connection to the local host is assumed.
CVM_MYSQL_USER
The MySQL login ID to connect as. If not set, the invoking user is assumed.
CVM_MYSQL_PASS
The password for the above user.
CVM_MYSQL_DB
The database name, must be set.
CVM_MYSQL_PORT
The port number for the TCP/IP connection (only used if the server is not local).
CVM_MYSQL_POSTQ (optional)
The SQL query to execute after the credentials have been validated, see cvm-sql(7).
CVM_MYSQL_PWCMP (optional)
The password comparison module to use.
CVM_MYSQL_SOCKET
The path to the socket that should be used for connections to a local server.
CVM_MYSQL_QUERY (optional)
The SQL query to issue to retrieve the row containing the account information from the database, see cvm-sql(7).
SEE ALSO cvm-sql(7), cvm-pgsql(8), cvm-pwfile(8), cvm-qmail(8), cvm-unix(8), cvm-vmailmgr(8), cvm-benchclient(8), cvm-checkpassword(8), cvm-test-
client(8)
http://untroubled.org/pwcmp/pwcmp.html
http://untroubled.org/cvm/cvm.html
cvm-mysql(8)