shell如何调用sqlplus(各种情况示例)
1、最简单的shell里调用sqlplus.$ vi test1.sh#!/bin/bashsqlplus -S /nolog <<EOFset heading off feedback off pagesize 0 verify off echo offconn test/testselect * from tab;exitEOF$ chmod +x test1.sh$ ./test1.sh

3、把sqlplus执行结果传递给shell方法二$ vi test3.sh#!/bin/bashsqlplus -S /nolog <<EOFset h髫潋啜缅eading off feedback off pagesize 0 verify off echo off numwidth 4conn test/testcol coun new_value v_counselect count(*) coun from tab;exit v_counEOFVALUE="$?"echo "The number of rows is $VALUE."$ chmod +x test3.sh$ ./test3.sh

5、为了安全要求每次执行shell都手工输入密码$ vi test5.sh#!/bin/bashecho -n "Enter password for u_test:"read PASSWDsqlplus -S /nolog <<EOFconn test/$PASSWDselect * from tab;exitEOF$ chmod +x test5.sh$ ./test5.sh

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:66
阅读量:37
阅读量:59
阅读量:46
阅读量:52