Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E2BC91337B5E for ; Mon, 22 Nov 2010 16:04:09 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 42172-05 for ; Mon, 22 Nov 2010 20:04:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outbound.vnet-inc.com (outbound.vnet-inc.com [216.146.104.103]) by mail.postgresql.org (Postfix) with ESMTP id A7BF31337B34 for ; Mon, 22 Nov 2010 16:04:02 -0400 (AST) Received: from [192.168.157.32] (te187.montanavision.com [216.220.28.187]) by outbound.vnet-inc.com (Postfix) with ESMTP id 885CE592A; Mon, 22 Nov 2010 13:04:03 -0700 (MST) Message-ID: <4CEACCC9.7000201@ttc-cmc.net> Date: Mon, 22 Nov 2010 13:04:25 -0700 From: dmp User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.13) Gecko/20100914 SeaMonkey/2.0.8 MIME-Version: 1.0 To: venkata siva prasad CC: pgsql-jdbc@postgresql.org Subject: Re: Insert null in int column References: <20101122175055.39596.qmail@f5mail-236-221.rediffmail.com> <4CEACAF8.5040907@ttc-cmc.net> In-Reply-To: <4CEACAF8.5040907@ttc-cmc.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201011/64 X-Sequence-Number: 21185 Sorry, In the code should have used: sqlStatement.executeUpdate(sqlStatementString); Don't need the ResultSet, rs. danap dmp wrote: > Hello Prasad, > > Attached class that should demostrate the insert you desire. The > insertion for Postgresql via SQL can be done through two different > methods. > > Singular Example: > INSERT/REPLACE INTO "bigInt_types" ("data_type_id", "bigint_type") > VALUES (NULL, '5'); > INSERT/REPLACE INTO "bigInt_types" ("data_type_id", "bigint_type") > VALUES (NULL, '-65'); > > Plural Example: > INSERT/REPLACE INTO "bigInt_types" ("data_type_id", "bigint_type") > VALUES (NULL, '5'),(NULL, '-65'); > > danap. > > venkata siva prasad wrote: >> Hi, >> >> I have created the table as below. >> >> create table test(id numeric(4),name character varying(8)); >> >> I need to insert null as below. >> >> insert into test values(null,'aaa'); >> >> But I am getting error as "Integer expecting..." >> >> >> Can you please help me on this. >> >> Regards, >> Prasad