Re: Best way to simulate Booleans

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Best way to simulate Booleans
Дата
Msg-id dcc563d10907062313j1f0eb27awc2bea6b3f810dc41@mail.gmail.com
обсуждение исходный текст
Ответ на Best way to simulate Booleans  ("Peter Headland" <pheadland@actuate.com>)
Ответы Re: Best way to simulate Booleans  (Dirk Jagdmann <jagdmann@gmail.com>)
Re: Best way to simulate Booleans  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-sql
On Mon, Jul 6, 2009 at 7:22 PM, Peter Headland<pheadland@actuate.com> wrote:
> I know, I know, PostgreSQL has Booleans that work very nicely.
> Unfortunately, I have to create a schema that will work on Oracle as well as
> PostgreSQL, by which I mean that a single set of Java/JDBC code has to work
> with both databases. I have an XML meta-schema that enables me to generate
> appropriate DDL; that handles all the INTEGER vs. NUMBER(m,n) stuff. But
> Oracle simply has no Booleans, so I will have to resort to some more or less
> ugly alternative. I am hoping that others here have had to deal with this
> and can suggest an approach that will be minimally loathsome.

The most transportable method would be to use either a char(1) or an
int with a check constraint.

mybool char(1) check (mybool in ('t','f'))
mybool int check (mybool >=0 and <=1)

Or something like that.


В списке pgsql-sql по дате отправления:

Предыдущее
От: Andre Rothe
Дата:
Сообщение: Re: Sequences
Следующее
От: Dirk Jagdmann
Дата:
Сообщение: Re: Best way to simulate Booleans