下面,我尝试打印存储在input.lst
a.poid_id0
应该存储在一个变量中a.Account_obj_id0
应该存储在另一个变量b.BILL_INFO_ID
应该存储在另一个变量b.PAYINFO_OBJ_ID0
应该存储在另一个变量中b.poid_id0
应该存储在另一个变量中。我需要在while循环中使用以上这些变量。
SPOOL input.lst
sqlplus -s ${DB_STRING} << EOF
select a.poid_id0,a.Account_obj_id0, b.BILL_INFO_ID,b.PAYINFO_OBJ_ID0,b.poid_id0
from ACCT_IBAN_ASSOCIATION_T a, billinfo_t b
where a.ACCOUNT_OBJ_ID0 = b.ACCOUNT_OBJ_ID0
and b.BILL_INFO_ID !='Account Bill';
SPOOL OFF
EOF
答案 0 :(得分:0)
您可以尝试以下 col1,col2,col3等应该是您的变量:
output=$(sqlplus -S ${DB_STRING} << EOF
select a.poid_id0,a.Account_obj_id0, b.BILL_INFO_ID,b.PAYINFO_OBJ_ID0,b.poid_id0
from ACCT_IBAN_ASSOCIATION_T a, billinfo_t b
where a.ACCOUNT_OBJ_ID0 = b.ACCOUNT_OBJ_ID0
and b.BILL_INFO_ID !='Account Bill';
SPOOL OFF
EOF
)
echo -e "$output" | while read col1 col2 col3 (etc..) ; do ... ; done