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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script information needed chris1234 UNIX for Dummies Questions & Answers 3 12-17-2007 03:35 PM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 12:06 AM
Script execution information manthasirisha Shell Programming and Scripting 12 07-07-2006 05:54 AM
SunWS_cache: Information: Database is locked, waiting RishiPahuja High Level Programming 3 09-16-2005 09:58 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-25-2008
Registered User
 

Join Date: Mar 2008
Posts: 26
Stumble this Post!
A script pls( To retrieve database information)

KSH - Unix -AIX - db2

**************
Get the input from the user say '123' (It varies)

Then i want to connect to a database say "D1"
then i want th extract from the database by giving "select * from tablename where input = '123'

I also want to connect to another database "D2"
then i want th extract from the database by giving "select * from tablename where input = '123'

output should be displayed on the screen as it is when i execute the select statements individually.
********************************
This is what i want to do in a script

Can you show a script for that(For eg)?
Forum Sponsor
  #2 (permalink)  
Old 04-26-2008
Registered User
 

Join Date: Mar 2008
Location: MUMBAI, INDIA
Posts: 25
Stumble this Post!
Quote:
Originally Posted by rollthecoin View Post
KSH - Unix -AIX - db2

**************
Get the input from the user say '123' (It varies)

Then i want to connect to a database say "D1"
then i want th extract from the database by giving "select * from tablename where input = '123'

I also want to connect to another database "D2"
then i want th extract from the database by giving "select * from tablename where input = '123'

output should be displayed on the screen as it is when i execute the select statements individually.
********************************
This is what i want to do in a script

Can you show a script for that(For eg)?

##############################################
Data Base Connection & Get information from DB
##############################################

echo "Enter Input File Name"
read FILE

# To check the value in TABLE_CFS_DUMP table FILE_NAME value

RETVAL=`sqlplus -silent USERNAME/PASSWORD@DBNAME <<EOF
set pagesize 0 feedback off verify off heading off echo off
select * from TABLE_CFS_DUMP where FILE_NAME like '$FILE';
exit;
END`

echo "The DB Query Output is: $RETVAL "
  #3 (permalink)  
Old 04-26-2008
Registered User
 

Join Date: Mar 2008
Posts: 26
Stumble this Post!
Is this a script . Can i have it in a well defined form? please
  #4 (permalink)  
Old 04-26-2008
DukeNuke2's Avatar
Soulman
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 1,291
Stumble this Post!
this smells like homework.... please read the rules!
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:10 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0