0 Replies · Latest reply on Dec 6, 2017 6:25 AM by kavita Hasija

    How to push Numeric/Date type data into SQL Database using JDBC Workflow activity

      I am trying to push data from my custom table to PostgreSQL Database using custom JDBC workflow activity.

      I am able to push data into database tables where the datatypes of columns are of "String" format.

       

      However if the table columns in the database are of "Numeric" or "Date" type, I get below error:

       

        "errorMessages": "org.postgresql.util.PSQLException: ERROR: invalid input syntax for type numeric"

      and

        "errorMessages": "org.postgresql.util.PSQLException: ERROR: invalid input syntax for type date"

       

      Data which needs to pushed is returned from a Script Include into the Pre-Processing Script of JDBC activity.

       

      Below is the Script Include code snippet and pre-processing script :

       

      Script Include:

       

      getInstance: function(current){

      var res2 = new GlideRecord('table_name');

      res2.addQuery('instance', astans.sys_id);

      res2.query();

      while(res2.next()){

      this.answer= parseInt(res2.value);                   //passing numeric value

      }

      return(this.answer);

      }

       

      Pre-processing script:

       

      var  inst = new BMW_Performance_Assessment().getInstance(current);

      activityInput.answer_Q01 = inst;                         //answer_Q01 is the column in the database of Numeric datatype

       

       

      How to pass numeric value into the database?