The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 03-18-2009
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,400
Quote:
Originally Posted by balireddy_77 View Post
hi Friends,

Please help me in writing shell script to run list of sql files.
database is Oracle 9i,
unix os is solaris
Requirement is
1. sql file must take two inputs a)feed id and b)business date
2.shell script must out put .xls or .csvfile as out put without trimming any column name and column value.
result of the sql may return around 60000 records...

please provide sample .sql file ans sample unix shell script.

thanks in advance..
--bali
you can try as shown below

Code:
 
echo "enter feed id : \c"
read feed_id
echo "enter date : \c"
read buss_date
sqlplus -s / << EOF
##to stop trimming column name you can use 
column "column_name" format a(columnsize in no)
set page size 60000
spool query_result.csv
####your query here####you can use $feed_id and $buss_date in your query as you want
exit
EOF