您的位置:首页 > 数据库 > Oracle

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;后面的"/"必须要有!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: