Обсуждение: Postgres 8.1 sequences and 'CALL'-syntax

Поиск
Список
Период
Сортировка

Postgres 8.1 sequences and 'CALL'-syntax

От
"Schnabl, Sebastian"
Дата:
Hello,

I use postgres 8.1 and trie to run jboss over sequoia-ha (http://sequoia.continuent.org/HomePage). But i have an
problemwith sequences. Sequoia claims to support for good reasons and db-independece only "sql-standard(s)". Therefore
theyDON'T support the postgres-specific "select nextval('seq_name')". Instead they gave me the hint to use the
sql-conform"call nexval('seq_name')". 

But unfortunately i always get only an syntax error on "call" from jdbc-driver or specially postgres as result.

How can i use sequences in conjunction with "call"-syntax??

Thx in advance


______________________________________________________________
 Sebastian Schnabl
 Qualitype AG
 Quality Assurance Systems |Bioinformatics
 Moritzburger Weg 67 | 01109 Dresden
 fon +49.351.8838 0 | fax +49.351.8838 2809
 http://www.qualitype.de
______________________________________________________________



Re: Postgres 8.1 sequences and 'CALL'-syntax

От
Kris Jurka
Дата:

On Thu, 27 Apr 2006, Schnabl, Sebastian wrote:

>
> Hello,
>
> I use postgres 8.1 and trie to run jboss over sequoia-ha
> (http://sequoia.continuent.org/HomePage). But i have an problem with
> sequences. Sequoia claims to support for good reasons and db-independece
> only "sql-standard(s)". Therefore they DON'T support the
> postgres-specific "select nextval('seq_name')". Instead they gave me the
> hint to use the sql-conform "call nexval('seq_name')".

I'm not sure where they layer their stuff on, but the pg jdbc driver will
support something like the following:

Connection conn = ...
CallableStatement cs = conn.prepareCall("{? = call nextval('seq_nm')}");
cs.registerOutParameter(1, Types.BIGINT);
cs.execute();
long nextval = cs.getLong(1);
cs.close();

Kris Jurka