drop
?
table
?book;
drop
?sequence?book_seq;
drop
?
trigger
?book_tri;
--
创建表格
create
?
table
?book
(
bookId?
integer
?
primary
?
key
?
not
?
null
,
bookName?
varchar2
(
20
),
price?
number
(
3
)
)tablespace?zfs_data
desc
??book;
--
创建序列
--
创建一个从10000开始每次递增为1的序列
create
?sequence?book_seq?minvalue?
10000
?maxvalue?
9999999
?increment?
by
?
1
?start?
with
?
10000
?;
--
创建一个触发器,用于每次插入前自动成成序列的值
create
?
or
?
replace
?
trigger
?book_tri
??before?
insert
?
on
?book?
for
?each?row
??
begin
????
select
?book_seq.nextval?
into
?:new.bookId?
from
?dual;
??
end
;
/
??
commit
;??
insert
?
into
?book?(bookName,?price)?
values
(
'
深入浅出EXTJS
'
,
59
);
insert
?
into
?book?(bookName,?price)?
values
(
'
深入浅出Jquery
'
,
49
);
select
?
*
?
from
?book;