ID CHAR(10) not null,
NAME VARCHAR2(25) not null,
PHONE VARCHAR2(10) not null,
ADDRESS VARCHAR2(50) not null,
constraint "SYS_C003049" primary key ("ID")
);
SQL> create sequence seq_Addressbook_
2 increment by 1
3 start with 1
4 minvalue 1
5 nocache;
2,创建触发器
SQL> create or replace trigger users_text
before insert on ADDRESSBOOK
for each row
begin
select to_char(seq_Addressbook_id.nextval) into:new.id from dual;
end users_text;
/
3, 测试
SQL> insert into addressbook (name,phone,address)
2 values('gj','11','bj');
已创建 1 行。
SQL> select * from addressbook;
ID NAME PHONE
---------- ------------------------- ----------
ADDRESS
--------------------------------------------------
u100 33 11
22
2 gj 11
bj