" /> Query to select last two hours data in OCS - Genesys CTI User Forum

Author Topic: Query to select last two hours data in OCS  (Read 1861 times)

Offline skmani

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Query to select last two hours data in OCS
« on: October 26, 2014, 07:03:00 AM »
Advertisement
Our requirement is to filter the data for last two hours data(it may change the hours based on the requirement ).The data is keep inserting from web service to the outbound database. Here we need to capture the data based on the custom field. In outbound table we use one column called custom01 which have the data insertion time based on the custom01 we need filter out the last two hours ( the time may vary based on the business requirement  ) to dial the data .

I have written query to fetch the last two hours but not sure how to put filter in callinglist

select * from walg_pc_callinglist  where to_date(SUBSTR(custom01, 1,8),'mm/dd/yy') =  TO_DATE(to_char(SYSDATE,'mm/dd/yy'),'mm/dd/yy') and EXTRACT(hour FROM to_timestamp(custom01,'mm/dd/yy hh24:mi:ss')) >( EXTRACT(HOUR FROM to_timestamp(to_char(systimestamp,'mm/dd/yy hh24:mi:ss'),'mm/dd/yy hh24:mi:ss'))-2)

Please provide solutions to filter the data

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: Query to select last two hours data in OCS
« Reply #1 on: October 26, 2014, 02:28:43 PM »
Your filter should be the WHERE part only, go to advanced View. Probably you will need to create to lines of it on CME due the length of the query.
« Last Edit: October 26, 2014, 05:44:40 PM by cavagnaro »