Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2002
    Posts
    16

    Unanswered: null values in DATE fields

    Hi guys,
    I was wondering how I can select rows in an Oracle database where the value of a field of type DATE is blank?

    I used the following queries as examples and the field active_date has blank values:

    select *from tableA
    where active_date = null

    and

    select *from tableA
    where active_date = ""

    In both cases, I obtain no rows back although there are existing rows.

    Any ideas what's wrong with both my sql statements ?

    I would be most grateful if you could let me know.
    Thanks
    Tony

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: null values in DATE fields

    Originally posted by tho
    Hi guys,
    I was wondering how I can select rows in an Oracle database where the value of a field of type DATE is blank?

    I used the following queries as examples and the field active_date has blank values:

    select *from tableA
    where active_date = null

    and

    select *from tableA
    where active_date = ""

    In both cases, I obtain no rows back although there are existing rows.

    Any ideas what's wrong with both my sql statements ?

    I would be most grateful if you could let me know.
    Thanks
    Tony
    where active_date IS null

    Nothing is ever equal to null, not even another null!

  3. #3
    Join Date
    May 2003
    Posts
    3

    Re: null values in DATE fields

    Hi,

    it's always like that if you want retrieved null rows!

    -> Select * from Table A
    Where active_date is NULL;

    your reference:

    select *from tableA
    where active_date = ""


    EVanier

  4. #4
    Join Date
    Apr 2002
    Location
    California, USA
    Posts
    482

    Thumbs up

    Blank row means NULL. And you cannot have something = NULL. You don't compare NULL to something, because you don't knows what is it.

    So use IS NULL and you will get your results.


    Hope that helps,

    clio_usa
    OCP - DBA
    Visit our Web Site

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •