SQL语句——20、sqlplus与shell结合
[oracle@dba ~]$ cat a.sh #!/bin/bash TAB=emp sqlplus -s scott/password << 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 ~]$ cat a.sh #!/bin/bash TAB=emp sqlplus -s scott/password << 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