[oracle@dba ~]$ cat a.sh
#!/bin/bash
TAB=emp
sqlplus -s scott/seker << EOF | awk 'NR != 1 && $2 ~ /S.*T/{print $2,$6}'
set head off
set feed off
select * from $TAB;
exit;
EOF
[oracle@dba ~]$ ./a.sh
SMITH 800
SCOTT 3000
[oracle@dba ~]$
当前位置: 数据库>oracle
Oracle基础教程:SQLPLUS与shell结合
来源: 互联网 发布时间:2017-04-22
本文导语: Oracle基础教程:SQLPLUS与shell结合 [oracle@dba ~]$ cat a.sh #!/bin/bashTAB=emp sqlplus -s scott/seker << EOF | awk 'NR != 1 && $2 ~ /S.*T/{print $2,$6}'set head offset feed offselect * from $TAB;exit;EOF[oracle@dba ~]$ ./a.sh SMITH 800SCOTT 3000[oracle@dba ~]$