Rajesh
Rajesh

Reputation: 1

whenever im passing the createdTs in 12hrs format im able to fetch the data but if pass it in 24hrs format in postman im getting this error

if pass the time in 24hrs format still i need to fetch the deatils from DB,createdTs is of Type String i have declared in my code but it is Timestamp type in DB

@Query(value="Select * from CODE_SET Where CREATED_TS >=:createdTs,To_Date('YYYY-MM-DD HH24:MI:SS')", nativeQuery=true) public List<Object[]> getCodeSetByCreatedTs(@Param(value="createdTs")String createdTs);

i tried it but getting something like:ORA-00933: SQL command not properly ended

Upvotes: 0

Views: 68

Answers (1)

Harsha Gandikota
Harsha Gandikota

Reputation: 166

The createdTs in the query should be inside the To_Date function so that it can be converted into the appropriate format. This is probably why you are getting the error.

You can try to change your query to something like this

@Query(value="Select * from CODE_SET Where CREATED_TS>=To_Date(:createdTs,'YYYY-MM-DD HH24:MI:SS')", nativeQuery=true) public List<Object[]> getCodeSetByCreatedTs(@Param(value="createdTs")String createdTs);

Upvotes: 0

Related Questions