Re: JDBC problem - Mailing list pgsql-interfaces

From John McKown
Subject Re: JDBC problem
Date
Msg-id Pine.LNX.4.21.0008241808520.2783-100000@linux2.johnmckown.net
Whole thread Raw
In response to JDBC problem  (BogdanKRomski <b.kromski@gaschka.pl>)
Responses Re: JDBC problem
List pgsql-interfaces
The syntax that I've seen is:

insert into KEY_ITEM (key_item_id,keyname) values
(select max(key_item_id)+1,'?' FROM KEY_ITEM);

Just out of curiousity, why not make key_item_id a SERIAL field? That way,
if you don't specify a value, it gets the next value from the associated
sequence.

On Tue, 22 Aug 2000, BogdanKRomski wrote:

> Hello
> 
> I'm using the Postgresql 6.5 and i try to perform statement
> 
> INSERT into KEY_ITEM (key_item_id,keyName) values(((SELECT
> MAX(key_item_id) FROM KEY_ITEM)+1),?)
> 
> and I get the message :
> 
> Error: ERROR:  parser: parse error at or near "select"
> 
> I'm not sure but  part  "(SELECT MAX(key_item_id) FROM KEY_ITEM)+1)" of
> statement does't work
> 
> thanks for all informations
> 
> Bogdan Kromski
> 
> ps. on Oracle and Sybase it is working correct
> 



pgsql-interfaces by date:

Previous
From: "Alex Drobyish"
Date:
Subject: ODBC driver fails to change float/numeric fields
Next
From: Manika dey
Date:
Subject: using large objects with jdbc