shell脚本,操作oracle数据库
2016-03-17 14:40
411 查看
insertOrUpdateByArln(){
echo insertOrUpdate $1 $2
sqlplus -s ${ora_userid}/${ora_password}@${instance} 1>sql.log 2>&1 <<EOF!
declare
t_count number;
index_id number;
begin
select count(*) into t_count from TRR_ARL_CTL where arln ='$1';
select arlk into index_id from TRR_ARL_CTL where ROWNUM =1 order by arlk desc;
index_id:=index_id+1;
if t_count< 1 then
insert into tableName()
values(index_id);
index_id:=index_id+1;
insert into tableName()
values(index_id);
else
update tableName set where ;
end if;
commit;
end;
/
exit
EOF!
cat sql.log
}
end;后面的"/"必须要有!
echo insertOrUpdate $1 $2
sqlplus -s ${ora_userid}/${ora_password}@${instance} 1>sql.log 2>&1 <<EOF!
declare
t_count number;
index_id number;
begin
select count(*) into t_count from TRR_ARL_CTL where arln ='$1';
select arlk into index_id from TRR_ARL_CTL where ROWNUM =1 order by arlk desc;
index_id:=index_id+1;
if t_count< 1 then
insert into tableName()
values(index_id);
index_id:=index_id+1;
insert into tableName()
values(index_id);
else
update tableName set where ;
end if;
commit;
end;
/
exit
EOF!
cat sql.log
}
end;后面的"/"必须要有!
相关文章推荐
- 12C-OCP升级1z-060-011
- oracle中 rowid 和rownum的使用
- sqoop 从oracle 导入hdfs 上报 java heap space 错误
- oracle创建监听Oracle Net Services 配置失败。退出代码是1
- oracle日期时间数据类型字段更新例子
- oracle下新建用户
- oracle树形查询语句
- 【JAVA】oracle批量插入数据操作
- ORACLE时间常用函数(字段取年、月、日、季度)
- Oracle 分区表
- C# 连接 Oracle 的几种方式
- PLSQL查询oracle数据乱码问题
- 转:oracle 10g函数大全--分析函数
- oracle按时间创建分区表
- windows7安装oracle 10g
- Oracle Study之--Oracle 11gR2构建RAC之hosts文件故障
- Oracle Study之--Oracle 11gR2构建RAC之hosts文件故障
- Linux下Oracle 12c的卸载
- Oracle Study之--Oracle 11gR2访问ASM disk group错误
- Oracle Study之--Oracle 11gR2访问ASM diskgroup错误