0
我已经编写了一个代码,它在执行后会给我所需的输出。unix shell脚本中的SQL查询
下面是代码:
#!/bin/ksh
sqlplus/<< !EOF!
set verify off
set heading off
set pagesize 0
set feedback off;
select * from account where account_name='23553558101';
exit;
!EOF!`
的问题是,我得到的所有非必需的东西太多,但我只需要输出没有其他的东西与沿。
下面是我得到的输出:
$ ./sqltest
SQL*Plus: Release 10.2.0.1.0 - Production on Mon May 29 17:32:52 2017
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining Scoring Engine and Real Application Testing options
17:32:52 [email protected] > 17:32:52 [email protected] > 17:32:52 [email protected] > 17:32:52 [email protected] > 17:32:52 [email protected] > 17:32:52 [email protected] > 56566309 23553558101 20-05-2017 05:41:00 57194135 20000184 64,56
20-05-2017 00:00:00 340393871 338845845 500 0
0
17:32:52 [email protected] > 17:32:52 [email protected] > Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining Scoring Engine and Real Application Testing options
这不是完全清楚你非需要的东西的意思,但我猜Oracle连接信息,所以如果是这样的话,你只需要需要调用“sqlplus -s /”来建立一个无声的sql连接 – Mike
我写下面的代码:#!/ bin/ksh sqlplus -s/nolog <<!EOF! 集上 集标题关闭 组trimout回声关闭 集合页大小0 组反馈关闭 SELECT * FROM帐户其中ACCOUNT_NAME = '23553558101'; 退出; !EOF!' 我收到下面的错误:$ ./sqltest SP2-0640:没有连接 – User123
为什么在你的/你的调用“sqlplus -s/nolog”之后有一个nolog部分? 从sql的角度来看,你要求连接没有用户使用nolog作为密码。您可以连接“sqlplus -s用户名/密码”或使用数据库密码文件“sqlplus -s /” – Mike