我有查询的结果:
SELECT leg_store_wh_code || ',' || rms_location col1 from SKS_CNV_LOCATION_XREF as
101,101 1,601 202,602 3,603 4,604 207,607 8,608 9,609 10,610 212,612 613,613 14,614 16,616 17,617 18,618 619,619 20,620 21,621 23,623 24,624 85,625 26,626 28,628 29,629 30,630 31,631 32,632 90,633 34,634 635,635 36,636(store_list_result holds this)
我想使用循环内的所有值。但只有第一个值是打印。它会进入下一个值。谁能帮助我
store_list="SELECT leg_store_wh_code || ',' || rms_location col1 from SKS_CNV_LOCATION_XREF ;"
store_list_result=`sqlplus -s $UP <<EOF
SET FEEDBACK OFF
SET HEAD OFF
SET AUTOPRINT OFF
SET LINESIZE 1000
SET TAB OFF
SET ECHO OFF
SET PAGESIZE 0
SET TERMOUT OFF
SET TRIMSPOOL ON
${store_list}
exit
EOF`
for i in store_list_result
do
LEG_ID=`echo $store_list_result | cut -d',' -f1`
echo $LEG_ID
RMS_ID=`echo $store_list_result | cut -d',' -f2 | cut -d' ' -f1`
echo $RMS_ID
我得到的结果是:
101
101