2012-09-11 12 views
9

Son bir saat içinde güncellemeleri almak için koşuyorum.Oracle, son bir saat içinde güncellemelerin güncellemelerini güncelledi

select count(*) 
from my_table 
where last_updated_date between to_date(to_char(sysdate,'YYYY-MM-DD HH24'))-1/24 and to_date(to_char(sysdate,'YYYY-MM-DD HH24')); 

Bizim DB oracle olduğunu ve

ORA-01861: literal does not match format string 
01861. 00000 - "literal does not match format string" 
*Cause: Literals in the input must be the same length as literals in 
      the format string (with the exception of leading whitespace). If the 
      "FX" modifier has been toggled on, the literal must match exactly, 
      with no extra whitespace. 
*Action: Correct the format string to match the literal. 

Bu başarısızlığın sebebi nedir vererek başarısız olduğunu?

cevap

26

sadece 1 saat önce

select count(*) from my_table where last_updated_date >= (sysdate-1/24) 
zamanını almak için SYSDATE den 1/24 çıkart
İlgili konular