0
votes

I have a column with the format of datetime: TRANDATE

In the query, there is a condition of startdate and enddate that shows all the transactions that have occurred between those dates of the column TRANDATE.

I want to add a condition of TIME in hour. So that it should return all the transactions that have occured between the starttime and endtime hour of TRANDATE.

The query would have 4 parameters: TRANDATE between startdate and enddate TRANDATE between starthour (number) and endhour (number)

How do I do the time (hour) part ?

1
Can you please refer stackoverflow.com/questions/12916611/… and see this resolves? - Abdul Hameed
PLEASE show sample table data and expected output. - OldProgrammer
There is no 'datetime' data type is Oracle? Do you mean DATE or TIMESTAMP? - Bob Jarvis - Reinstate Monica

1 Answers

3
votes

You can add a condition on hour between HOUR_START and HOUR_END this way:

... AND EXTRACT(HOUR FROM TRANDATE) BETWEEN HOUR_START AND HOUR_END ...