sql - Column type to store 0..7 (octal) and bool values (oracle, postgres) -


i create table in oracle , need make single column following values 0, 1, .., 6, 7

create table "loc_db"."ti_ts" (     "bit" char(1)  constraint cons_ti_ts_bit check (bit in      ('0','1','2','3','4','5','6','7'))  ) 

this the one best way? or, maybe, we've got special types(octal number system)

(in case of postgresql question interests too)


edit 1

i told practice better:

create table "loc_db"."ti_ts" (     "bit" number(1,0) not null  constraint const_ti_ts_bit check (bit between 0 , 7),      "activ" number(1,0) not null  constraint const_ti_ts_active check (activ in (0,1)),  ) 

thanks matt allwood, a_horse_with_no_name


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -