Received: from aventurine.sge.net (aventurine.sge.net [152.91.14.25]) by hub.org (8.9.3/8.9.3) with ESMTP id AAA38002 for ; Mon, 15 Nov 1999 00:44:49 -0500 (EST) (envelope-from G.MacMinn@nca.gov.au) Received: from cadmium.sge.net (cadmium.sge.net [152.91.9.5]) by aventurine.sge.net (8.9.3/8.9.3) with ESMTP id QAA19317 for ; Mon, 15 Nov 1999 16:44:46 +1100 (EST) Received: (from uucp@localhost) by cadmium.sge.net (8.9.3/8.9.3) id QAA09880 for ; Mon, 15 Nov 1999 16:44:45 +1100 (EST) Received: from nodnsquery(10.1.2.11) by cadmium.sge.net via smap (V5.0) id xma009823; Mon, 15 Nov 99 16:44:35 +1100 Received: from amber (amber-int2.sge.net [10.1.2.254]) by kryptonite.sge.net (8.9.3/8.9.3) with SMTP id QAA78689 for ; Mon, 15 Nov 1999 16:44:34 +1100 (EST) Message-Id: X-Mailer: Novell GroupWise 5.2 Date: Mon, 15 Nov 1999 16:43:12 +1100 From: "Gary MacMinn" To: pgsql-sql@postgreSQL.org Subject: [SQL] Handling NULL Dates Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.org id AAA38327 Hello All, I'm trying to find out if PostgreSQL has a function like NVL that replaces null values with a default? I have a table with datetime fields, some of which are null. I'm trying to extract the date and time components with the date() and time() functions but the null values break these functions. If NVL is not there, could anyone suggest alternatives? TIA, Gary MacMinn ================ Table = test1 +----------------------------------+----------------------------------+-------+ | Field | Type | Length| +----------------------------------+----------------------------------+-------+ | t1 | text | var | | d1 | datetime | 8 | +----------------------------------+----------------------------------+-------+ Query : SELECT t1, date(d1) from test1; //The date() function breaks if the d1 field is not set.