Joined: 20 Oct 2006 Posts: 6968 Location: porcelain throne
well, putting a scalar function on every row is not very efficient.
i would instead:
where timestamp_column between timestamp('2010-06-21', '00.00.00') and
the above format may or may not work on your version of db2,
nor have I tested it, because I don't have the time.
This would be good experience for you.
suggest you work in spufi until you are able to generate accurate timestamps
SELECT timestamp('2010-06-21', '00.00.00')
, timestamp('2010-06-21', '23.59.59')
until that works.
then substitute the proper format/syntax of the timestamp('2010-06-21', '00.00.00')
in your basic sql.
addressing your original question,
if you had an sqlcode of 0, that means you do not have any rows
containing a timestamp within the date.
if you had an sqlcode <> 0, then say so.
probably would be a good idea if you
fetch first 10 rows only
to see what valid dates exists, then construct your select with timestamp
for an existing date.