07-01-2009
Try this,
#!/bin/bash
exec<InputFilename
while read line
do
$ORACLE_HOME/bin/sqlplus -s username/Password <<!
select * from Tablename where Fieldname='$line'
/
!
done
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi
I want to get the a field from a SQL query into unix shell script variable. the whole situation is like this.
1. Opened a cursor to a table in DB2 databse.
2. Fetching individual rows with the help of cursor.
3. Each row has 4 fields.
I want each of the field in individual shell... (1 Reply)
Discussion started by: skyineyes
1 Replies
2. UNIX for Dummies Questions & Answers
This is basically what I want to do:
I have a file that contains single lines of IDs.
I want to query the oracle database using these IDs
to get a count of which ones match a certain condition.
the basic idea is:
cat myfile |
while read id
do
$id in select count(PC.ptcpnt_id)
from... (4 Replies)
Discussion started by: whoknows
4 Replies
3. Shell Programming and Scripting
Hi ,
I used the below script to get the sql data into csv file using unix scripting.
I m getting the output into an output file but the output file is not displayed in a separe columns .
#!/bin/ksh
export FILE_PATH=/maav/home/xyz/abc/
rm $FILE_PATH/sample.csv
sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies
4. Shell Programming and Scripting
I need to run sql script from shell script which takes the input from a file and contents of file will be like :
12345
34567
78657
and query will be like :
select seq_nbr from bus_event where event_nbr='12345';
select seq_nbr from bus_event where event_nbr='34567';
select seq_nbr... (1 Reply)
Discussion started by: rkrish
1 Replies
5. Shell Programming and Scripting
Hi,
I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database.
For instance:
USER CITY
--------- ----------
A CITY_A
B CITY_B
C ... (2 Replies)
Discussion started by: DevendraG
2 Replies
6. Shell Programming and Scripting
Please share the doc asap as very urgently required. (1 Reply)
Discussion started by: 24ajay
1 Replies
7. Shell Programming and Scripting
I have written a shell script that calls below sql file. It is not sending the query data in table in the body of email.
spool table_update.html;
SELECT * FROM PROCESS_LOG_STATS where process = 'ActivateSubscription';
spool off;
exit;
Please use code tags next time for your code and data.... (9 Replies)
Discussion started by: Sharanakumar
9 Replies
8. Shell Programming and Scripting
Hi All,
Seeking for your assistance to read each line $1 and $2 of input file and used it to query.
Ex. file1.txt(number range)
9064500000 9064599999
9064600000 9064699999
9064700000 9064799999
Database name: ranges_log
a_no message
9064500001 test
9064700000 ... (7 Replies)
Discussion started by: znesotomayor
7 Replies
9. UNIX for Dummies Questions & Answers
Dear experts,
I am new to linux programming. I have a shell script which i should run it on all my samples.
I only define input and out put for this script. The inputs are 3 numbers(coordination numbers) which are available in a series of text file.
Since i have a lots of samples, it takes a... (5 Replies)
Discussion started by: mohamadreza
5 Replies
10. Shell Programming and Scripting
I want to run sql query in shell script and output data save as delimited text (delimited text would be comma)
Code:
SPOOL_FILE=/pgedw/dan.txt
SQL=/pgedw/dan.sql
sqlplus -s username/password@myhost:port/servicename <<EOF
set head on
set COLSEP ,
set linesize 32767
SET TRIMSPOOL ON
SET... (8 Replies)
Discussion started by: Jaganjag
8 Replies
LEARN ABOUT OPENSOLARIS
endusershell
getusershell(3C) Standard C Library Functions getusershell(3C)
NAME
getusershell, setusershell, endusershell - get legal user shells
SYNOPSIS
#include <unistd.h>
char *getusershell(void);
void setusershell(void);
void endusershell(void);
DESCRIPTION
The getusershell() function returns a pointer to a legal user shell as defined by the system manager in the file /etc/shells. If
/etc/shells does not exist, the following locations of the standard system shells are used in its place:
/bin/bash /bin/csh
/bin/jsh /bin/ksh
/bin/ksh93 /bin/pfcsh
/bin/pfksh /bin/pfsh
/bin/sh /bin/tcsh
/bin/zsh /sbin/jsh
/sbin/pfsh /sbin/sh
/usr/bin/bash /usr/bin/csh
/usr/bin/jsh /usr/bin/ksh
/usr/bin/ksh93 /usr/bin/pfcsh
/usr/bin/pfksh /usr/bin/pfsh
/usr/bin/sh /usr/bin/tcsh
/usr/bin/zsh /usr/sfw/bin/zsh
/usr/xpg4/bin/sh
The getusershell() function opens the file /etc/shells, if it exists, and returns the next entry in the list of shells.
The setusershell() function rewinds the file or the list.
The endusershell() function closes the file, frees any memory used by getusershell() and setusershell(), and rewinds the file /etc/shells.
RETURN VALUES
The getusershell() function returns a null pointer on EOF.
BUGS
All information is contained in memory that may be freed with a call to endusershell(), so it must be copied if it is to be saved.
NOTES
Restricted shells should not be listed in /etc/shells.
SunOS 5.11 1 Nov 2007 getusershell(3C)