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 > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Process multiple records returned

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-13-04, 19:13
gomes009 gomes009 is offline
Registered User
 
Join Date: Feb 2004
Posts: 37
Process multiple records returned

The following Array (file_var) is declared in a shell script.
set -A file_var
${file_var[0]}
${file_var[1]}
${file_var[2]}
${file_var[3]}
${file_var[4]}
${file_var[5]}
${file_var[6]}
${file_var[7]}
${file_var[8]}
${file_var[9]}
set -A file_var `$ORACLE_BIN/sqlplus -s $UN/$PW@$SID @pass_out.sql

The pass_out.sql script returns more than 1 record. I want to process all the records returned by the sql in a loop and then exit.

Any help is appreciated

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-14-04, 08:43
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
The length of an array can be determined using...
Code:
${#ARRAY[*]}
So you would want to implement something like this...
Code:
while (( ${i=0} < ${#ARRAY[*]} )); do print ${ARRAY[$i]}; i=$((i + 1)); done
HTH
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