create or replace procedure
sp_test
(
aa in varchar
,
bb in number default 0
)
is
v_pos
varchar(50
);
v_num number
;
begin
---字符串查找和替换
select SUBSTR(PARAMETER, 1, INSTR(PARAMETER,branchId)-2) ||
SUBSTR(PARAMETER, INSTR(PARAMETER,branchId)
+length(branchId)) into v_pos from
dual;
---循环的使用
loop
if bb is null then ---if 判断
exit; ---退出循环
end if
;
if v_num >= bb then
exit
;
end if
;
v_num := v_num +1
;
end
loop;
---输出信息
dbms_output.put_line('aaaaa'
);

..
commit
;
exception
when NO_DATA_FOUND then --没有记录的异常
dbms_output.put_line('ddddd'
);
when others then
begin
--输出错误信息
dbms_output.put_line(sqlerrm);
rollback
;
---抛出异常
raise;
end
;
end sp_test;










































