There is an insert that writes to the database:

clients.each{ stmt.addBatch(insert into consumer (id, creation_date) values (consumer_seq.nextval, to_date(${new Date().format('yyyy-MM-dd')}, 'yyyy-MM-dd')) 

As a result, oracle writes ora-01840 the length of the input value is insufficient for the date format

  • client_id skipped. Three fields are specified, and only two values ​​are transmitted. Is this how it was conceived or an error when publishing? - default locale
  • yes just a publishing error. - fox.ontour

1 answer 1

Add quotes for the first TO_DATE argument. Not good at Groovy, I guess it will look something like this:

 ... to_date('${new Date().format('yyyy-MM-dd')}', 'yyyy-MM-dd')) 

As I understand it, the error occurs because this part of the expression:

 to_date(${new Date().format('yyyy-MM-dd')}, 'yyyy-MM-dd') 

Converted to the following SQL:

 to_date(2018-11-08, 'yyyy-MM-dd') 

The first argument is an expression whose result is: 1999 number. Oracle converts it to the string '1999' and then tries to bring the string to a date by format, which naturally leads to an error.