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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script query max29583 UNIX for Dummies Questions & Answers 4 08-07-2008 06:09 AM
C Shell Script query bpupdown Shell Programming and Scripting 1 05-13-2008 07:38 PM
executing a SQL query in shell script lijju.mathew Shell Programming and Scripting 1 05-17-2007 11:29 AM
Query on a shell script logic tipsy Shell Programming and Scripting 1 06-29-2006 05:38 PM
Connecting DB in the Shell Script to do SQL Query mehuldoshi UNIX for Advanced & Expert Users 3 03-29-2003 12:47 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-07-2008
a1_win a1_win is offline
Registered User
  
 

Join Date: Apr 2005
Posts: 33
Patch query using shell script error

Hi All,

OS:AIX 5.3

I am using the following shell script for patch query but not getting the prompt to enter values for '&From_date' and '&TO_Date' in the patch query when called from the shell script as below:

patch_query.sh
============

#!/usr/bin/ksh

export DBALIST="xyz@xyz.com"
export USER=apps
export PWD=******
export SID=XYZ

sqlplus "$USER/$PWD" <<!
@patch_query.sql
exit
!
if [ `cat patch_query.alert|wc -l` -gt 0 ]
then
cat patch_query.alert -l patch_query.alert > patch_query.tmp
mailx -s "Patch Query Alert for ${SID}" $DBALIST < patch_query.tmp
fi

patch_query.sql
===============

set feed off
set linesize 100
set pagesize 200
spool patch_query.alert
select BUG_NUMBER "PATCH_NUMBER",to_char(creation_date,'DD-MON-YYYY HH24:MI:SS') CREATION_DATE from ad_bugs
where to_char(creation_date,'DD-MON-YYYY HH24:MI:SS') between '&From_date' and '&TO_Date';
spool off;

Error message:
==============


$ /home/oraxyz $ ./patch_query.sh

SQL*Plus: Release 10.2.0.3.0 - Production on Tue Oct 7 08:16:25 2008

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> Enter value for from_date: Enter value for to_date:
User requested Interrupt or EOF detected.
SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
cat: 0652-050 Cannot open -l.
$ /home/oraxyz $

could anyone please let me know how to do it?

Thanks for your time!

Regards,
  #2 (permalink)  
Old 10-09-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,864
Let's do some debugging. Replace "sqlplus" with "cat >&2". Now run the script and redirect error to some file:

./patch_query.sh 2>debug.$$

Does it prompt now? Does debug.$$ contain the "right" output?
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0