【发布时间】:2016-06-30 12:30:52
【问题描述】:
我的任务非常简单,假设我的表有 3 列,即 temp(ids, name_c, UID_c),我有前两列值,第三列可以为空。我想要做的是每当插入这两个值时,必须用新值更新第三列的值(插入后)。即两个值的串联。
例如。
insert into temp(ids, name_c) values(did.nextval,'Andrew');
结果应该是
1 Andrew Andrew_1
所以我为此目的使用触发器
create or replace trigger triggerDemo
after INSERT
on temp
for each row
declare
/* pragma autonomous_transaction;*/
user_name varchar2(50);
current_val number;
begin
select did.currval into current_val from dual; /* did is sequence */
select names into user_name from temp where ids = current_val;
update temp set uid_c = user_name||'_'||ids where ids = current_val;
end;
当我插入值时出现此错误
01403. 00000 - "no data found"
*Cause: No data was found from the objects.
*Action: There was no data from the objects which may be due to end of fetch.
【问题讨论】:
标签: sql oracle11g oracle-sqldeveloper