null value of type java.sql.Time

Started by phil campaigneover 21 years ago4 messagesgeneral
Jump to latest
#1phil campaigne
pcampaigne@charter.net

Occasionally I want to store a null value for my java.sql.Time--> Time
column in Postgresql.
update event set game_clock=null where event_id=1;

I can retreive the record with the null value (type Time) if I select
on the primary key,
select game_clock from event where event_id = 1;

but when I try to select on the null column value, I get zero records.
select * from event where game_clock=null;

How can I retreive records with null values for a column?
thanks,
Phil

#2Thomas Hallgren
thhal@mailblocks.com
In reply to: phil campaigne (#1)
Re: null value of type java.sql.Time

phil campaigne wrote:

Occasionally I want to store a null value for my java.sql.Time--> Time
column in Postgresql.
update event set game_clock=null where event_id=1;

I can retreive the record with the null value (type Time) if I select on
the primary key,
select game_clock from event where event_id = 1;

but when I try to select on the null column value, I get zero records.
select * from event where game_clock=null;

Try
select * from event where game_clock is null;

A null value cannot be used in a comparison since it's undefined. You
have to explicitly query for something that has no value, hence the
different syntax.

Regards,
Thomas Hallgren

#3Gregory S. Williamson
gsw@globexplorer.com
In reply to: Thomas Hallgren (#2)
Re: null value of type java.sql.Time

Try:
SELECT * FROM event WHERE game_clock IS NULL;

Greg Williamson
DBA
GlobeXplorer LLC

-----Original Message-----
From: phil campaigne [mailto:pcampaigne@charter.net]
Sent: Monday, November 22, 2004 2:33 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] null value of type java.sql.Time

Occasionally I want to store a null value for my java.sql.Time--> Time
column in Postgresql.
update event set game_clock=null where event_id=1;

I can retreive the record with the null value (type Time) if I select
on the primary key,
select game_clock from event where event_id = 1;

but when I try to select on the null column value, I get zero records.
select * from event where game_clock=null;

How can I retreive records with null values for a column?
thanks,
Phil

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

#4Net Virtual Mailing Lists
mailinglists@net-virtual.com
In reply to: Gregory S. Williamson (#3)
Re: null value of type java.sql.Time

Try:

select * from event where game_clock IS NULL

- Greg

Show quoted text

Occasionally I want to store a null value for my java.sql.Time--> Time
column in Postgresql.
update event set game_clock=null where event_id=1;

I can retreive the record with the null value (type Time) if I select
on the primary key,
select game_clock from event where event_id = 1;

but when I try to select on the null column value, I get zero records.
select * from event where game_clock=null;

How can I retreive records with null values for a column?
thanks,
Phil