ibm midrange - DB2 for IBM i (iSeries) Date - Need to Compare (Current Date - 1) -
i new db2 ibm (iseries) syntax. compare date field in table yesterday's date (current date - 1) auditing purposes. however, cannot work. receive "[sql0182] date, time, or timestamp expression not valid" error. appreciated. see code below.
select decimal_field schema.table date(insert(insert(digits(decimal_field), 5, 0, '-'), 8, 0, '-')) > date(varchar_format(timestamp_iso(current date), 'yyyy-mm-dd')) - 1 , decimal_field <> 0
specify duration.
select decimal_field schema.table date(insert(insert(digits(decimal_field), 5, 0, '-'), 8, 0, '-')) > date(varchar_format(timestamp_iso(current date), 'yyyy-mm-dd')) - 1 day , decimal_field <> 0
also comparison can simplified:
select decimal_field schema.table date(insert(insert(digits(decimal_field), 5, 0, '-'), 8, 0, '-')) > current_date - 1 day , decimal_field <> 0
Comments
Post a Comment