Re: tough one

From: John Anderson <panic(at)semiosix(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: tough one
Date: 2001-08-10 17:58:54
Message-ID: 4.2.0.58.20010810195504.00a893e0@frank
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

At 16:51 2001/08/09 +0200, Tony Grant wrote:
>festival | filmid
>------------------------------------------
>1979 | 102, 103, 104
>1980 | 258, 369, 489, 568
>
>How can I simulate an ARRAY of this type? If I can't - where is the
>nearest bridge?

you could define a table with this data:

festival | filmid
------------------------------------------
1979 | 102
1979 | 103
1979 | 104
1980 | 258
1980 | 369
1980 | 489
1980 | 568

with a query like this:

select filmid from films where festival = '1980'

and use a loop like this to generate an array

Vector films = new Vector();
while ( rs.next() )
{
films.add ( rs.getString ( "filmid" ) );
}

bye
John

In response to

  • tough one at 2001-08-09 14:51:38 from Tony Grant

Browse pgsql-jdbc by date

  From Date Subject
Next Message Joseph Shraibman 2001-08-10 18:06:08 Re: NullPointerException on next()
Previous Message Barry Lind 2001-08-10 16:36:50 Re: Re: JDBC 2.0 conformance, documentation and todo list