Re: [SQL] Best way to simulate Booleans

2009-07-07 Thread Greg Stark
On Tue, Jul 7, 2009 at 10:17 AM, Simon Riggs wrote: > > > Integer works best since it converts easily to boolean > > mybool smallint check (mybool in (0, 1)) > > You can use "char" also, but the syntax is less clear. Hm, I was going to suggest using boolean in postgres and making a "boolean" domai

Re: [SQL] Best way to simulate Booleans

2009-07-07 Thread Simon Riggs
On Tue, 2009-07-07 at 00:13 -0600, Scott Marlowe wrote: > On Mon, Jul 6, 2009 at 7:22 PM, Peter Headland 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

Re: [SQL] Best way to simulate Booleans

2009-07-07 Thread Dirk Jagdmann
> 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) I would decide depending on the application requirement. If my Oracle should look similar to PostgreSQL use t

Re: [SQL] Best way to simulate Booleans

2009-07-06 Thread Scott Marlowe
On Mon, Jul 6, 2009 at 7:22 PM, Peter Headland 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.

[SQL] Best way to simulate Booleans

2009-07-06 Thread Peter Headland
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 appropri