Question: I would like to merge date & time. I have used 'CONCAT' function & also '||' function. But both of functions taking more times and very slow for query. Can somebody tell me how i can reduce the query time? & What function can be used to merge the date & time? Thanks for any help. 

```

    where CONCAT (TO_CHAR (Date, 'YYYYMMDD'), LPAD (Time, 6, 0))
between CONCAT ('20180215', '130528') AND CONCAT ('20180215', '133003')

```

Answer: 
You do not need to convert your date to a string - just convert your static values to a date:

```
WHERE "Date" BETWEEN TO_DATE( '20180215130528', 'YYYYMMDDHH24MISS' )
                 AND TO_DATE( '20180215133003', 'YYYYMMDDHH24MISS' )

```

If you want to use `CONCAT` then:

```
WHERE "Date" BETWEEN TO_DATE( CONCAT( '20180215', '130528' ), 'YYYYMMDDHH24MISS' )
                 AND TO_DATE( CONCAT( '20180215', '133003' ), 'YYYYMMDDHH24MISS' )

```

You could also use a `TIMESTAMP` literal:

```
WHERE "Date" BETWEEN TIMESTAMP '2018-02-15 13:05:28'
                 AND TIMESTAMP '2018-02-15 13:30:03'

```
You want to have an index on Date to speed up the query.  

And better yet would be to have Date and Time combined into a single field Date, with type Date (and have index on Date). 
This would give you a simple performant query:

```
WHERE Date between to_date('20180215' || '130528', 'YYYYMMDDHH24MISS') and to_date('20180215'||'133003', 'YYYYMMDDHH24MISS') 

```

For your current scheme, you will get better performance structuring WHERE like this:

```
where Date between to_date('20180215', 'YYYYMMDD') and to_date('20180215', 'YYYYMMDD') and Date || LPAD (Time, 6, 0)) between CONCAT ('20180215', '130528') AND CONCAT ('20180215', '133003')

```