Insert null in int column
Re: Insert null in int column
От:
Maciek Sakrejda <msakrejda@truviso.com>
Дата:
1. Is this a jdbc-specific issue? If so, please post the Java code, not just SQL. If not, this is not the right list (try pgsql-general or pgsql-novice). 2. This works fine for me (verbatim) in psql. --- Maciek Sakrejda | System Architect | Truviso 1065 E. Hillsdale Blvd., Suite 215 Foster City, CA 94404 (650) 242-3500 Main www.truviso.com
Re: Insert null in int column
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
>
>
>
Re: Insert null in int column
От:
dmp <danap@ttc-cmc.net>
Дата:
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