Oracle's lack of a Bit datatype for table columns

后端 未结 9 982
醉酒成梦
醉酒成梦 2021-02-05 03:13

Oracle does not support a bit datatype or any other type for true/false scenarios. Does one use the char(1) field instead by using a specific letter to

9条回答
  •  别那么骄傲
    2021-02-05 03:58

    I prefer char(1) over number(1), since with some reasonable choice of characters, it is obvious which character has which boolean meaning.

    Of course you should fight all the different varations, choose one and ensure it's use by putting check constraints on the columns.

    Although it probably is to late in your case, generating the schema from another tool often takes care at least of the consistency issue. I personally prefer hibernate for this purpose, but that is very situation specific.

    And of course that is a glaring obmission. To make it worse, PL/SQL has a boolean, but you can't use it in SQL statements.

提交回复
热议问题