孤燈野火
          暢想的天空
          posts - 2,comments - 4,trackbacks - 0
        1. drop table book;   
        2. --創(chuàng)建表      
        3. create table book(       
        4.    bookId varchar2(4) primary key,   
        5.    name varchar2(20)         
        6. );   
        7. --創(chuàng)建序列      
        8. create sequence book_seq start with 1 increment by 1;    
        9.   
        10. --創(chuàng)建觸發(fā)器      
        11. create or replace trigger book_trigger       
        12. before insert on book       
        13. for each row       
        14. begin       
        15. select book_seq.nextval into :new.bookId from dual;      
        16. end ;   
        17. --添加數(shù)據(jù)      
        18. insert into book(name)  values ('cc');    
        19. insert into book(name)  values ('dd');   
        20.   
        21. commit
        22. posted on 2010-11-29 09:46 孤飛燕 閱讀(219) 評論(0)  編輯  收藏 所屬分類: 數(shù)據(jù)庫
          主站蜘蛛池模板: 建始县| 买车| 镇赉县| 岳池县| 兰溪市| 昌黎县| 汝城县| 资讯 | 井陉县| 长武县| 闻喜县| 和林格尔县| 泰州市| 湖口县| 驻马店市| 邓州市| 凯里市| 安仁县| 海伦市| 朔州市| 疏附县| 泽州县| 青铜峡市| 富民县| 甘南县| 西宁市| 淅川县| 永春县| 林周县| 锡林浩特市| 塘沽区| 梅州市| 乌苏市| 永康市| 长武县| 宝鸡市| 汽车| 高雄市| 翼城县| 安吉县| 永城市|