我如何 运行 3 while 在 unix 中同时循环并在我们获得输出后立即将每个循环的输出更新到数据库
how can i run 3 while loops simultaneously in unix and update the output of each loop to database as soon we get the output
我有一个程序必须从数据库中获取信息 & 在 unix 中执行所需的命令后,o/p 必须更新回 database.here 从 3 table 中获取信息 & 输出一旦我得到每个循环的输出,就必须更新为一个 table。
`#{Here the loop must run untill i get values from table}
x=0
while [ $x = '0' ]
do
x=`sqlplus -s username/pswd@server << EOF
set head off
select min(col1),max(col1) from table
/
EOF`
echo $x|read a b
x=$a+$b
done
#{here functions based on a & b value }
#{below to update table}
sqlplus -s username/pswd@server<< EOF
update table2 set col3 where ..
commit;
#similar while loop
y=0
while [ $y = '0' ]
do
x=`sqlplus -s username/pswd@server << EOF
set head off
select min(col1),max(col1) from table3
/
EOF`
.
.
您可以将每个循环放在一个函数中,然后在后台调用这些函数
函数循环 1
{...}
函数循环 2
{...}
函数循环 3
{...}
循环 1 &
循环2 &
loop3 &
我有一个程序必须从数据库中获取信息 & 在 unix 中执行所需的命令后,o/p 必须更新回 database.here 从 3 table 中获取信息 & 输出一旦我得到每个循环的输出,就必须更新为一个 table。
`#{Here the loop must run untill i get values from table}
x=0
while [ $x = '0' ]
do
x=`sqlplus -s username/pswd@server << EOF
set head off
select min(col1),max(col1) from table
/
EOF`
echo $x|read a b
x=$a+$b
done
#{here functions based on a & b value }
#{below to update table}
sqlplus -s username/pswd@server<< EOF
update table2 set col3 where ..
commit;
#similar while loop
y=0
while [ $y = '0' ]
do
x=`sqlplus -s username/pswd@server << EOF
set head off
select min(col1),max(col1) from table3
/
EOF`
.
.
您可以将每个循环放在一个函数中,然后在后台调用这些函数
函数循环 1
{...}
函数循环 2
{...}
函数循环 3
{...}
循环 1 &
循环2 &
loop3 &