create or replace trigger t_hepub_terminal
before insert on hepub_terminal
referencing new as new old as old
for each row
declare
-- local variables here a_terminalcode varchar2(200);
a_PK_TERMINAL_H varchar2(20);
begin
a_terminalcode:=:new.terminalcode;
a_PK_TERMINAL_H:=:new.PK_TERMINAL_H;
if length(trim(nvl(a_terminalcode,'')))=0 or a_terminalcode is null then --业务类型定义
--回复短信内容定义
---a_terminalcode:=zhongduandaima.nextval;
select cast(zhongduandaima.nextval as varchar2(5)) into a_terminalcode from dual;
update hepub_terminal set terminalcode=a_terminalcode where PK_TERMINAL_H=a_PK_TERMINAL_H;
---and terminalcode is null;
--任务
end if;
end T_hepub_terminal;
这个触发器有什么问题
新增后 自增量已经加1了 但是没有写入到hepub_terminal 表中
before insert on hepub_terminal
referencing new as new old as old
for each row
declare
-- local variables here a_terminalcode varchar2(200);
a_PK_TERMINAL_H varchar2(20);
begin
a_terminalcode:=:new.terminalcode;
a_PK_TERMINAL_H:=:new.PK_TERMINAL_H;
if length(trim(nvl(a_terminalcode,'')))=0 or a_terminalcode is null then --业务类型定义
--回复短信内容定义
---a_terminalcode:=zhongduandaima.nextval;
select cast(zhongduandaima.nextval as varchar2(5)) into a_terminalcode from dual;
update hepub_terminal set terminalcode=a_terminalcode where PK_TERMINAL_H=a_PK_TERMINAL_H;
---and terminalcode is null;
--任务
end if;
end T_hepub_terminal;
这个触发器有什么问题
新增后 自增量已经加1了 但是没有写入到hepub_terminal 表中
解决方案 »
- oracle11gR2 中 sga_target=0 然后shared_pool_size=0,db_8k_cache_size=0
- SQL?
- 关于oracle遍历检索
- 在包中如何实现函数的递归调用??
- 求救pl/sql 游标 数据缓冲区太小异常
- 刚开始学oracle,请教关于插入数据的简单问题
- 怎么样让oracle默认的日期格式为yy-mm-dd hh:mm:ss啊,不用to_date
- 关于这个SQL帮忙给点建议
- 谁知道OUTLN这个用户是干什么用的?
- 字段更新追加问题
- SYS登录提示"connection as SYS should be as SYSDBA or SYSOPER"
- 请教PL/SQL如何查看执行计划 - 实例分析
我也不是很懂
如果要这样的话需要使用自治事务的你想要这个触发器实现什么功能?
将表中PK_TERMINAL与插入的新PK_TERMINAL相等的那些行的terminalcode改成新的terminalcode?
create or replace trigger t_hepub_terminal
before insert on hepub_terminal
for each row
declare
a_terminalcode varchar2(200);
begin
select to_char(zhongduandaima.nextval) into a_terminalcode from dual;
:new.terminalcode:=a_terminalcode;
end;
/
minvalue 1
maxvalue 9999999999999999
start with 1
increment by 1
cache 20
order;
------------------
create or replace trigger DATA_PRODUCT_ID
before insert on user.table for each row
declare
currentNum NUMBER(10);
begin
select HARD_SEQ.nextval into currentNum from dual;
:new.ID := currentNum;
end DATA_PRODUCT_ID;