bash nohup 执行ORACLE SQL

su - oracle

touch ss.sh

vi ss.sh

#!/bin/bash

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1

export ORACLE_SID=jsdb1

export PATH=/u01/app/oracle/product/11.2.0.3/dbhome_1/bin:/usr/local/bin

sqlplus -S cjcl/cjclpassword << EOF

spool /home/oracle/Scripts/20140730.sh.log

set serverout on

set timing on

exec dbms_output.put_line(to_char(sysdate,’yyyy-mm-dd hh24:mi:ss’));

UPDATE CJCL.C2013_000000_611_1 A

SET A.B191 = (

CASE WHEN NVL(A.B1921,0) >= 300 THEN ‘1’

ELSE CASE WHEN NVL(A.B1921,0) >= 100 AND NVL(A.B1921,0) < 300 THEN ‘2’

ELSE CASE WHEN NVL(A.B1921,0) >= 10 AND NVL(A.B1921,0) < 100 THEN ‘3’

ELSE CASE WHEN NVL(A.B1921,0) < 10 THEN ‘4’

ELSE ”

END

END

END

END

)

WHERE bgq=’201301YY’ and substr(zzjgdm,1,2) IN (‘11’,’12’,’21’,’31’,’32’,’34’,’44’) AND (

SUBSTR(A.B103,1,2) IN (‘73’,’74’,’75’,’76’,’77’,’78’,’79’,’80’,’81’,’84’,’85’,’86’,’87’,’88’,’89’)

OR

SUBSTR(A.B103,1,3) IN (‘703’,’709’)

) ;

commit;

spoo off

EOF

nohup /home/oracle/ss.sh > /home/oracle/ss.log

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值