Oracle 10g declare number field > 2000
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;
精彩评论