Home » RDBMS Server » Server Administration » Get Count using Date and Time
Get Count using Date and Time [message #375180] Thu, 02 August 2001 14:44 Go to next message
nmoshou
Messages: 4
Registered: June 2001
Junior Member
With the select statment below I am trying to get a count of the deals with a trade_dtm between 12AM and 10AM, but when I run the statement I get error ORA-01830. Can anyone help me with my error? The statement runs OK if I take out the time and just count by day.

select count(*)
from dcaf_deals d,
dcaf_sd_deals_vw sd
where d.system_of_origin_id(+) = 3615
and d.origin_deal_num(+) = to_char(sd.deal_id)
and d.dcaf_id is null
and (sd.buyer_contract_num is not null or
sd.seller_contract_num is not null)
and sd.dcaf_deal_type_cd is not null
and sd.spot_term_cd is not null
and sd.active_cd in('ACTIVE','SUSPENDED')
and sd.trade_dtm >= '30-JUL-01 00:00:00'
and sd.trade_dtm < '31-JUL-01 10:00:00'
Re: Get Count using Date and Time [message #375181 is a reply to message #375180] Thu, 02 August 2001 15:45 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
you need to convert from string to date. Be careful of the difference between rr and yy.

to_date('30-JUL-01 00:00:00', 'dd-mon-rr hh24:mi:ss')
Re: Get Count using Date and Time [message #375184 is a reply to message #375181] Thu, 02 August 2001 16:59 Go to previous message
nmoshou
Messages: 4
Registered: June 2001
Junior Member
Thanks for your help Andrew
Previous Topic: Re: How to copy records between 2 instances?
Next Topic: Re: set timing on
Goto Forum:
  


Current Time: Fri Jul 05 10:22:02 CDT 2024