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
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;后面的"/"必须要有!