The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Windows & DOS: Issues & Discussions
Google UNIX.COM


Windows & DOS: Issues & Discussions Questions involving Unix to Windows (Desktop or Server) go here. Any Windows/DOS questions should go here as well.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SQL statement output to Log file-How? vsubbu1000 HP-UX 1 08-21-2007 08:40 PM
grepping the output of a command in an if statement hcclnoodles Shell Programming and Scripting 3 06-29-2007 04:00 AM
Supress ' quotes in a select statement inside Shell Script mahabunta Shell Programming and Scripting 1 12-14-2006 03:29 PM
get the output of unix script in windows csrope Shell Programming and Scripting 1 06-27-2005 09:39 PM
Pipe SQL select statement results to script houtakker UNIX for Dummies Questions & Answers 6 10-31-2003 10:20 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-23-2005
Registered User
 

Join Date: May 2005
Posts: 3
Want to use the output of Select statement in Unix script

Hi,
I have a UNIX script which calls SQL Select statement:

Now i want to use the output of that select statement within my UNIX script so as to call different shell script depending upon the output of the select statement.

Can anyone help me in this regard.

TIA

Akhil Goel
Reply With Quote
Forum Sponsor
  #2  
Old 05-23-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Quote:
Originally Posted by akhilgoel9
Hi,
Can anyone help me in this regard.
Yes.....

.....if you post the contents of the script that you're using.

Cheers
ZB
Reply With Quote
  #3  
Old 05-23-2005
Registered User
 

Join Date: May 2005
Posts: 3
Want to use the output of Select statement in Unix script

Please have a look on the below example so as to let you know what exactly i need...


Shell Script:

echo " You are in shell script"

# Start of SQL

str=`sqlplus sa/sa <<eof!
set verify off
set heading off
set feedback off
Select * from table_case;
exit
eof!
`
# End of SQL

i would like to have the output of the above SQL query here..
# display result of above query
echo ???


i dont want to use stored proc
Reply With Quote
  #4  
Old 05-23-2005
Registered User
 

Join Date: May 2005
Posts: 3
UNIX and SQL

Also see if the below example is possible: can the variable of shell scripts (e.g. count) be accessible in SQL block, If yes then how?

Shell Script:

read count

# Start of SQL

str=`sqlplus sa/sa <<eof!
set verify off
set heading off
set feedback off
Select * from table_case where id = $count;
exit
eof!
`
# End of SQL
Reply With Quote
  #5  
Old 05-27-2005
Registered User
 

Join Date: Feb 2005
Location: Columbus OH
Posts: 133
If you want to send values to a SQL script as a command line parameter then call your sqlplus command with arguments as follows

sqlplus username/password argument1 argument2 ..

and within the sqlplus commands refer to the arguments as positional parameters as &1, &2 ..

Also if you want to send values from the sql scripts back into the calling environment you would have to write PL/SQL blocks coded into sql scripts which can communicate values from the sqlplus exeuctions as bind_variables. Then you can use the exit command as follows within the PL/SQL block and pass the bind variable back to the calling environment.

EXIT :BIND_VAR;

Jerardfjay
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:33 AM.


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

Content Relevant URLs by vBSEO 3.2.0