The UNIX and Linux Forums  

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 11:47 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-07-2008
Registered User
 

Join Date: Apr 2005
Posts: 25
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,
Reply With Quote
Sponsored Links
  #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,769
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?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Bookmarks

Tags
None

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:




All times are GMT -4. The time now is 12:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66