Forum Discussion

RohitBorse's avatar
RohitBorse
New Contributor
4 years ago

How to send oracle to_date function in groovy sql.call.

How to send oracle to_date function in groovy sql.call. to_date('2021-04-28-00.00.00','YYYY-MM-DD-HH24.MI.SS','NLS_CALENDAR=GREGORIAN')
  • RohitBorse's avatar
    4 years ago

    Ok, I have done something below

     

    import groovy.sql.Sql;
    import groovy.sql.GroovyRowResult;

     

    GroovyRowResult row = sql.firstRow("SELECT to_date('2021-04-28-00.00.00','YYYY-MM-DD-HH24.MI.SS','NLS_CALENDAR=GREGORIAN') AS MyDate FROM DUAL");
    def MyDate= row.MyDate;

    String RESULT = "";
    sql.call( "{call MYAPP.MYDATE.UPDATE_DATE(?, ?)}", [ sql.inout(Sql.VARCHAR(RESULT), MyDate])

    {OUT1 ->

    RESULT = OUT1;

    }