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

          雪山飛鵠

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

          BlogJava 首頁 新隨筆 聯系 聚合 管理
            215 Posts :: 1 Stories :: 674 Comments :: 0 Trackbacks
          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;
          posted on 2010-12-08 14:19 雪山飛鵠 閱讀(1727) 評論(0)  編輯  收藏 所屬分類: database
          主站蜘蛛池模板: 城固县| 葫芦岛市| 汤阴县| 古交市| 上虞市| 巍山| 望城县| 广昌县| 吉木萨尔县| 平安县| 牡丹江市| 双桥区| 临高县| 夏河县| 合阳县| 平安县| 乌什县| 海南省| 台山市| 弋阳县| 洛宁县| 涟水县| 浙江省| 资兴市| 丰镇市| 新疆| 比如县| 岗巴县| 威远县| 灌云县| 山丹县| 阳春市| 抚顺县| 宁明县| 望都县| 宜章县| 遵义县| 屏东县| 桐庐县| 嘉善县| 新化县|