17,082
社区成员
发帖
与我相关
我的任务
分享
declare
m_id int;
m_str varchar2(30);
begin
select fab_combo_seq.nextval into m_id from dual ; -- 这样写
insert into t (id) values (m_id);
commit ; -- 显式的提交
exception
when others then
rollback ; -- 显式的让这个事务回滚
m_str = '发生了错误';
end;
-- 大概这样,写成 PLSQL 块就可以了。
declare
m_id int;
m_str varchar2(30);
begin
m_id := 100;
insert into t (id) values (m_id);
exception
when others then
m_str = '发生了错误';
end;