oracle11g - Oracle SQL unsigned integer -
in oracle, equivalent mysql's unsigned?
i have following query, doesn't work:
create table foo ( id int unsigned not null primary key );
edit: purpose save space, because fields won't using negative values. alternatively, answer question of confirms i'm asking impossible in oracle 11g, or if it's possible, not straightforward (more 3 lines of code per unsigned int).
also, it's not int. use smallint , tinyint.
if want match restrictions shown here, can use check constraint:
sql> create table foo (id number primary key, constraint foo_uint_id check (id between 0 , 4294967295)); table created. sql> insert foo (id) values (-1); insert foo (id) values (-1) * error @ line 1: ora-02290: check constraint (scott.foo_uint) violated sql> insert foo (id) values (0); 1 row created. sql> insert foo (id) values (4294967295); 1 row created. sql> insert foo (id) values (4294967296); insert foo (id) values (4294967296) * error @ line 1: ora-02290: check constraint (scott.foo_uint_id) violated sql> select * foo; id ---------- 0 4294967295
Comments
Post a Comment