第一步:创建SEQUENCE
create sequence s_id increment by 1 start with 1 maxvalue 999999999;
第二步:创建一个基于该表的before insert 触发器,在触发器中使用该SEQUENCE
create or replace trigger bef_ins_t_country_define
before insert on TBL_USER
referencing old as old new as new for each row
begin
new.id=sid.nextval;
end;
create sequence s_id increment by 1 start with 1 maxvalue 999999999;
第二步:创建一个基于该表的before insert 触发器,在触发器中使用该SEQUENCE
create or replace trigger bef_ins_t_country_define
before insert on TBL_USER
referencing old as old new as new for each row
begin
new.id=sid.nextval;
end;
您是不是在Sqlplus.exe中执行这个语句的吗?
CREATE SEQUENCE "SCOTT"."TEST" INCREMENT BY 1 START WITH 1
MAXVALUE 1.0E27 MINVALUE 1 NOCYCLE
NOCACHE NOORDERCREATE OR REPLACE TRIGGER "SCOTT"."TEST" BEFORE INSERT
ON "TEST1"
FOR EACH ROW begin
select test.nextval into :new.id from dual;
end;
我进入sql*plus 用 system 可以进入,用别的用户 sys 还有我建立的用户(我已授权给他DBA了)不能进去
还想请教以下,那个:new.id 是什么意思啊
能不能讲的详细一点啊
他们有没有CONNECT,RESOURCE角色?
connect internal/oracle
grant CONNECT,RESOURCE to username;
要插入的行的id字段,
我想学,不知道看那方面的书
请大家教我怎样学Oracle ,看那方面的书