If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Unix host variables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-20-07, 10:36
skyineyes skyineyes is offline
Registered User
 
Join Date: Jun 2007
Posts: 4
Unix host variables

Hi

I want to get the a field from a SQL query into unix shell script variable. the whole situation is like this.

1. Opened a cursor to a table in DB2 databse.
2. Fetching individual rows with the help of cursor.
3. Each row has 4 fields.

I want each of the field in individual shell script variable.

please provide the shell script code for the same.

thanks
Reply With Quote
  #2 (permalink)  
Old 06-20-07, 11:18
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
something like this :
db2 -x "select TABLESPACE_ID,CONTAINER_NAME,\
case CONTAINER_TYPE when 0 then 'PATH' else 'FILE' end case ,\
TOTAL_PAGES \
from table( SNAPSHOT_CONTAINER('',-1)) as ts " | {
while read TSREC
do
set - $TSREC
ID=$1
CN=$2
CT=$3
TP=$4
.....
done
output of query will be stored in $ID - $CN-$CT-$TP and be handled with script statements..
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On