开发者

Oracle 10g declare number field > 2000

开发者 https://www.devze.com 2023-02-11 22:02 出处:网络
Hy folks, I need to declare a number field on a oracle database that needs to start on 2开发者_如何学Go000.

Hy folks, I need to declare a number field on a oracle database that needs to start on 2开发者_如何学Go000. How can I do it?

Thanks!


I'm not sure if you mean that it must be greater than 2000 or "start on 2000", but anyway:

CREATE TABLE mytable (
  mynumbercolumn NUMBER,
  CONSTRAINT min2000 CHECK (mynumbercolumn >= 2000)
);


You want to declare a sequence that starts at 2000?

CREATE SEQUENCE yoursequencename
    MINVALUE 2000
    START WITH 2000
    INCREMENT BY 1;

Skeleton syntax is

CREATE SEQUENCE sequence_name
    MINVALUE value
    MAXVALUE value
    START WITH value
    INCREMENT BY value
    CACHE value;
0

精彩评论

暂无评论...
验证码 换一张
取 消