溫馨提示:您的每一次轉(zhuǎn)載,體現(xiàn)了我寫此文的意義!!!煩請您在轉(zhuǎn)載時注明出處http://www.aygfsteel.com/sxyx2008/謝謝合作!!!

          雪山飛鵠

          溫馨提示:您的每一次轉(zhuǎn)載,體現(xiàn)了我寫此文的意義!!!煩請您在轉(zhuǎn)載時注明出處http://www.aygfsteel.com/sxyx2008/謝謝合作!!!

          BlogJava 首頁 新隨筆 聯(lián)系 聚合 管理
            215 Posts :: 1 Stories :: 674 Comments :: 0 Trackbacks
          drop table book;
          drop sequence book_seq;
          drop trigger book_tri;
          --創(chuàng)建表格
          create table book
          (
          bookId 
          integer primary key not null,
          bookName 
          varchar2(20),
          price 
          number(3)
          )tablespace zfs_data
          desc  book;
          --創(chuàng)建序列
          --
          創(chuàng)建一個從10000開始每次遞增為1的序列
          create sequence book_seq minvalue 10000 maxvalue 9999999 increment by 1 start with 10000 ;
          --創(chuàng)建一個觸發(fā)器,用于每次插入前自動成成序列的值
          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;
          posted on 2010-12-08 14:19 雪山飛鵠 閱讀(1733) 評論(0)  編輯  收藏 所屬分類: database
          主站蜘蛛池模板: 无极县| 平遥县| 波密县| 察雅县| 登封市| 新沂市| 额敏县| 盐山县| 丰原市| 广州市| 绥芬河市| 辽源市| 台江县| 潍坊市| 安义县| 郓城县| 泾阳县| 页游| 合作市| 达拉特旗| 新泰市| 济阳县| 兰西县| 玛纳斯县| 泾源县| 绥宁县| 丹东市| 二连浩特市| 宜都市| 龙海市| 喀喇沁旗| 阿克| 田阳县| 临泉县| 自贡市| 建昌县| 嘉祥县| 淅川县| 威宁| 常州市| 上犹县|