This content has been marked as final. Show 7 replies
user8721624 wrote:It should be something like:
Also, is this the correct SQL to add a new colun "flag" to table tblLocations:
ALTER TABLE tblLocations
ALTER COLUMN flag bit
I guess you can use CHAR(1) datatype to hold this data. Also you can create a check constraint on the flag_bit column to make sure that only 1 and 0 can be stored in the column.
ALTER TABLE tbllocations ADD FLAG_BIT CHAR(1)
Hope this helps.
Why not googled a bit?
[bit data type in oracle|http://www.google.co.in/search?hl=en&rlz=1G1GGLQ_ENIN333&q=bit+data+type+in+oracle&btnG=Search&meta=&aq=1&oq=bit+data]
why don't you use a number type datatype and have a check constraint like...
alter table tblLocations add flag number CONSTRAINT <constraintname> CHECK (flag IN (1,0));
Edited by: ravikumar.sv on Aug 19, 2009 11:09 AM
Hi you can simply do like this1 person found this helpful
ALTER TABLE table_name ADD column_name number(1);
ok thanks, ill do the char with constraints
You have to use check constraints otherwise you can insert any value into that column whether the data type is char or number.1 person found this helpful
yeah actually I thought that this questions is to choose the datatype . I have not seen the constraint part ONLY 0 and 1.