create sequence customerid increment by 1 start with 1 maxvalue 999999999create or replace trigger bef_ins_customer_autoid
before insert on customer
referencing new as newrow
for each row
when(newrow.id is null)
begin
select customerid.nextval into :newrow.id from dual
end;
但是编译时有warning,而且真正插入语句时也无法插入,
SQL Error: ORA-04098: 触发器 'bef_ins_customer_autoid' 无效且未通过重新验证
04098. 00000 - "trigger '%s.%s' is invalid and failed re-validation"
*Cause: A trigger was attempted to be retrieved for execution and was
found to be invalid. This also means that compilation/authorization
failed for the trigger.
*Action: Options are to resolve the compilation/authorization errors,
disable the trigger, or drop the trigger
解决方案 »
- oracle将什么复制到回滚段??
- Oracle杀死锁的问题
- 急!诚邀Oracle工程师有偿帮忙
- 重新安装Oracle时,应该将Oracle中哪些文件备份出来
- ORDER BY 的问题请帮忙
- 求助 根据两表相关联字段,随机抽取另一表相关数据
- 如何在linux下手工添加oracle数据库呢?希望大虾们不要不屑于回答,wait online....
- 能不能把oracle所有的表空间都放到裸设备上?
- ORACLE中PL-SQL写程序可以允许递归吗?
- 怎么樣把新建一個數據庫﹖
- 求iPlanet Application Server6.5下载地址(一定要可用的)
- oracle中可以使用DATE '2006-1-1'将'2006-1-1'转换成日期型,这是什么用法
BEFORE INSERT ON Customer
REFERENCING NEW AS newrow
FOR EACH ROW
WHEN (newrow.id IS NULL)
BEGIN
SELECT customerid.nextval into :newrow.id FROM dual;
END;
实测结果:
insert into Customer(id,name,phonenum,address)
values (null,'xiaowang','1412341234','beijing') 总是出现错误呢?我用的oracle sqldeveloper 会不会和这个有关系?但是不应该啊?