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
To spool output from a database query *Jess* Shell Programming and Scripting 0 04-07-2008 12:23 AM
Database Query jisha Shell Programming and Scripting 0 01-22-2008 03:13 AM
Dynamic update loop query on Sybase database Alaeddin Shell Programming and Scripting 10 12-13-2007 06:26 AM
query akash Shell Programming and Scripting 2 12-07-2007 06:37 AM
storing database query in a variable debu Shell Programming and Scripting 3 11-25-2007 07:59 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-17-2007
vivek_damodaran vivek_damodaran is offline
Registered User
  
 

Join Date: Sep 2005
Location: Milton Keynes, UK
Posts: 20
query to get a value from database

Hi friends,

I have written a script which retrieves one value from the database.
It takes time for the sql query to get the desired output. So the query runs fine from TOAD or from UNIX console.

However if I put this in a script it doesn't work. The script is as below.

#! /bin/ksh
DB_VALID_CDR=`sqlplus -s username/password<<!EOF | grep -v "^Connected" 2>&1
set termout off echo off feedback off pause off timing off time off
set pages 0
clear breaks
clear compute
set termout on
select a.VALUE_INTEGER from client_statistics a, statistic_type b where a.STATISTICS_TYPE=b.Statistic_type_id and a.STATISTICS_OBJECT like '%20071217102445_9673324_AG40_20071217101738_0000002118%' and b.STATISTIC_TYPE='valid_cdrs'
EXIT
!EOF`
echo $DB_VALID_CDR

I strongly believe that the issue is with the query taking time to return the value.

Please let me know how to tackle the issue.

Many thanks
  #2 (permalink)  
Old 12-17-2007
ermur ermur is offline
Registered User
  
 

Join Date: Jul 2007
Location: La Paz, Bolivia
Posts: 15
Semicolon

Hi Vivek

You forgot to put the semicolon ( at the end of the query, that's why your query is not executed.

Regards

Erwin
  #3 (permalink)  
Old 12-17-2007
vivek_damodaran vivek_damodaran is offline
Registered User
  
 

Join Date: Sep 2005
Location: Milton Keynes, UK
Posts: 20
Many thanks ermur....now its working

Cheers mate!!!
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 06:51 AM.


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