M. Barabas
M. Barabas

Reputation: 99

Slick 3.5.1 LocalDateTime parser taking only 3 nanosecond numbers

I am using scala slick library 3.5.1. I have implemented DB tables for Oracle profiles with LocalDateTime columns. When trying to select data, insert data I am getting

ORA-01830: date format picture ends before converting entire input string

It is because java.LocalDateTime.now() for example can return 9 nanoseconds like this (2024-09-30T14:23:58.583936100) and slick oracle profile localdatetime is accepting only 3 nanosecond numbers.

column definition

def startDate = column[LocalDateTime]("START_DATE")

query to get data

val date = LocalDateTime.now()

(for {
  reservation <- reservations
  if reservation.startDate >= date.bind
} yield reservation).result

SQL generated by slick library:

select * from tbl_reservations
where startDate >= TO_TIMESTAMP ('30-Sep-24 14:10:10.583936100', 'DD-Mon-RR HH24:MI:SS.FF3');

Is there any way how to resolve this issue in scala for the whole project (like overriding oracle profile ...) ?

Upvotes: 0

Views: 87

Answers (0)

Related Questions