I have a simple query that returns a date, count(column1),and sum(column2), as well as a couple of other columns. It has been running fine for months now, but today I got the ORA-24347: WARNING OF A NULL COLUMN IN AN AGGREGATE FUNCTION error. I did a query on both aggregate columns and there were no nulls (but there can be in the sum(column2)), which in a sum or count function should not matter any correct?

The query is part of a .sql file that runs 2 queries to make a simple text file report. The one that fails calculates its numbers with a "where trunc(datetime_in) > trunc(sysdate)-1" clause, the second query, which does not fail, gets exactly the same information but using a "and datetime_in >= trunc(add_months(sysdate,0),'mon')" clause.

Interestingly enough, I ran the select query standalone (without the compute and column formatting commands) in SQLPLUS from the UNIX prompt on the machine the database resides on, and it ran with no errors.

I also ran the whole sql script from SQLPLUS 3.3 on another machine, it ran with no errors, but when I tried it on SQLPLUS 8.1.6 at the same time it had the same error in the first query in the script again.

In desparation I put a "and coulumn2 is not null" clause in the first query and it ran ok, which fixes my problem for now, but I am curious why it just started doing this, and runs fine from other versions of SQLPLUS