Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8239

Groovy.Sql + Oracle retrieve DATE column value on executeInsert()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.4.12
    • None
    • SQL processing
    • None
    • jdk1.8.0_121, groovy 2.4.12, oracle ojdbc6 11.2.0.2.0

    Description

      I'm trying to insert a new row with the following code:

          def result = sqlInstance.executeInsert(
            [
              externalId: note.externalId,
              user      : note.username,
              notes     : note.note
            ],
            'INSERT INTO notes VALUES (notes_id_seq.NEXTVAL, :externalId, :user, sysdate, :notes)',
            ['ID', 'DATE_TIME']
          ).first()
      

      The insert works fine following the fix to GROOVY-8174. However, when SqlGroovyMethods.toRowResult() tries to read the ID and DATE_TIME columns back via the rs.getObject() it fails on the DATE_TIME column with a "java.sql.SQLException: Invalid column type". While debugging if I replace the getObject() call with a rs.getString() or a rs.getDate() the value is successfully retrieved.

      Attachments

        Activity

          People

            Unassigned Unassigned
            george.ivanov George Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: