【发布时间】:2015-03-26 14:39:15
【问题描述】:
我正在尝试从 shell 脚本连接到 oracle 数据库(我是新用户)。然后该脚本将传递一个查询并将结果传输到一个名为 canadacount 的变量。我已经写了代码,但它不起作用
#this script will attempt to connect to a remote database CFQ143 with user ID 'userid' and password 'password'.
#After loggin in it will read data from the PLATFORMSPECIFIC table.
#We can pass a query 'select count (platform) from platformspecific where platform='CANADA';
#The result from this query will be passed to a variable called canadacount which we can then echo back to the user.
canadacount='$ORACLE_HOME/bin/sqlplus -s /nolog<<EOF
connect userid/passsword@CFQ143:1521:CFQ143
set pages 0 feed off
select count (platform) from platformspecific where platform='CANADA';
exit
EOF'
echo $canadacount
【问题讨论】:
-
“它不起作用”的表达在这里很完美。那只是在屏幕上吐出文字,不会运行。
-
你想说什么
-
非常有趣的弗洛林...可能对你很幽默,但对我来说不是