The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 10-06-2006
BOFH BOFH is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 406
I don't know about the SQL commands themselves however if you want to assign the output of a command to a variable, you need to use the backtick marks.


Code:
cntADD=`sqlplus -s user/pwd select count(*) from tbl where...;`
cntCHA=`sqlplus -s user/pwd select count(*) from tbl where...;`
cntDEL=`sqlplus -s user/pwd select count(*) from tbl where...;`

Since I write to multiple environments, I typically drop to the lowest common denominator so you could also use these instead of backticks but backticks are universal


Code:
cntADD=$(sqlplus...)
cntCHA=$(sqlplus...)
cntDEL=$(sqlplus...)

But it might not work with your specific shell.

Carl