I am new to mybatis and I have a problem adding substring to the parameter I give to the sql query.
I am currently working on mybatis and I am trying to add a substring to the parameter I give to the sql query. I am using Oracle ojdbc14 with version 10.2.0.4.0.
This is what I expected from my trial:
AND EVT_OCCURDT BETWEEN TO_DATE('20171102 000000', 'YYYYMMDD HH24MISS') + 3/24
AND TO_DATE('20171102 235959', 'YYYYMMDD HH24MISS') + 3/24
And what I did was:
<if test="evt_occurdt != null and !evt_occurdt.equalsIgnoreCase('')">
AND EVT_OCCURDT BETWEEN TO_DATE(#{evt_occurdt} || ' 000000', 'YYYYMMDD HH24MISS') + 3/24
AND TO_DATE(#{evt_occurdt} || ' 235959', 'YYYYMMDD HH24MISS') + 3/24
</if>
And my trial ended with java.sql.SQLException: ORA-01843. I guess there is a problem with my syntax, but I can't find the right syntax including the parameter.
UPDATE
I tried some other solution:
<if test="evt_occurdt != null and !evt_occurdt.equalsIgnoreCase('')">
AND EVT_OCCURDT BETWEEN TO_DATE(TO_CHAR(#{evt_occurdt}, 'YYYYMMDD') || ' 000000', 'YYYYMMDD HH24MISS') + 3/24
AND TO_DATE(TO_CHAR{#(evt_occurdt}, 'YYYYMMDD') || ' 235959', 'YYYYMMDD HH24MISS') + 3/24
</if>
It still didn't work, with error code ORA-01481