![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| suggest book | haripatn | UNIX for Advanced & Expert Users | 6 | 05-02-2008 06:14 PM |
| Can you suggest a more efficient way for this? | mikie | Shell Programming and Scripting | 1 | 11-20-2006 10:49 AM |
| Look into this and suggest if any changes needed | me_haroon | AIX | 1 | 07-03-2006 06:39 AM |
| How to get the knowledge in UNIX? Suggest me . Please. | nani_ynm | UNIX for Dummies Questions & Answers | 2 | 12-06-2005 11:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Two SQL connections..suggest changes.
Guys,
My requirement is to spool the resultset of an SQL query to a text file.And one of the select columns of the SQL query is obtained dyamically from the result set of 2 other SQL queries. And shell scripts looks as below: OUTPUT=$(sqlplus -s xxxx/yyyy@xyz101 << EOF | grep -v "^$" set head off select a.col_name ......................; select a.col_name ......................; exit EOF) ls_curr_fact=$(echo $OUTPUT | awk '{ print $1 }') ls_last_fact=$(echo $OUTPUT | awk '{ print $2 }') ls_fact_amount="sum(${ls_curr_fact}-${ls_last_fact})" sqlplus -s xxxx/yyyy@xyz101 << EOF | tee -a ${LOG_FILE} SET SHOWMODE off SET FEEDBACK OFF SET VERIFY off SET RECSEP off SET TRIMSPOOL on SET LINESIZE 20000 SET HEADING OFF SET PAGESIZE 0 SET PAGES 0 WHENEVER SQLERROR EXIT SQL.SQLCODE; spool ${TEMP1} SELECT 'B'||','||FD.GEO_ID||','||FD.PROD_ID||','||','||','||','||','||$ls_fact_amount............. You can see the select column "ls_fact_amount" is obtained from the resultset of two other queries above. The cumbersome with the above block is that I've two SQL connections to the same database instance. Could someone suggest changes to my block to simply the SQL connections to just one and get my job done. Thanks, Bhagat |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|