其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
sequences的用法

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

CREATE SEQUENCE supplier_seq
    MINVALUE 1
    MAXVALUE 999999999999999999999999999
    START WITH  1
    INCREMENT BY  1
    CACHE 20;

This would create a sequence object called supplier_seq.  The first sequence number that it would use is 1 and each subsequent number would increment by 1 (ie: 2,3,4,...}.  It will cache up to 20 values for performance.

Now that you've created a sequence object to simulate an autonumber field, we'll cover how to retrieve a value from this sequence object.  To retrieve the next value in the sequence order, you need to use nextval.

For example:

supplier_seq.nextval

This would retrieve the next value from supplier_seq.  The nextval statement needs to be used in an SQL statement.  For example:

INSERT INTO suppliers
(supplier_id, supplier_name)
VALUES
(supplier_seq.nextval, 'Kraft Foods');




相关文章

相关软件