title: java.sql.SQLException: ORA-01704: string literal too long When Insert Or Update
body: <p>Normally when i insert 4000 character limit its works fine but when over 4000 character its throw SQL Exception string literal too long even my DISCHARGE_TEXT data type is CLOB</p>
  
  <p><strong>My JavaScript code is</strong> </p>
  
  <pre><code>function saveAsDraftNew(){
      var admissionNo = document.getElementById("apnNo").value;
      if (admissionNo == "") {
          alert("Please Insert Admission Number");
          berak;
      } else {
          var idval = "";
          var regNo = document.getElementById("regNo").innerHTML;
          var editorValue = document.getElementById("editor").value;
          //alert(editorValue.length);
          alert(editorValue);
          editorValuee = unescape(editorValue);
          //alert(editorValuee.length);
          //alert(editorValuee);
          var referredTo = document.getElementById("otherAnswer").value = "";
          var modeOfDischarge = document.getElementsByName('answer');
          for ( var i = 0; i &lt; modeOfDischarge.length; i++) {
              if (modeOfDischarge[i].checked) {
                  var rate_value = modeOfDischarge[i].value;
  
  
                      $jf.ajax({
                                  type: "POST",
                                  url:"saveEditorValueAsTemplateIPDPatientInfo.do",
                                  data:{
                                      patientAdmissionNo:admissionNo,
                                      editorValueM:editorValuee,
                                      btnYesM:idval,
                                      regNoM:regNo,
                                      referredToM:referredTo,
                                      rate_valueM:rate_value,
                                  },
                                  success : function(result) {
                                      $jf("#btndiv").html(result);
                                  },
                  });
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>My Action Class Code is</strong></p>
  
  <pre><code>private String patientAdmissionNo = null;
  Date date;
  String regNoM;
  String btnYesM = "";
  String editorValueM = "";
  String referredToM = "";
  String rate_valueM;
  
  public String saveEditorValueAsTemplate() {
      String[] logInInfo = (String[]) ActionContext.getContext().getSession()
              .get(sessionVariable.getUserLogInInfo());
      String specialization_no = logInInfo[12];
      int specializationInt = specialization_no == null
              || specialization_no.isEmpty() ? 0 : Integer
              .parseInt(specialization_no);
      String doctorEmpId = logInInfo[1].toString();
      String companyNo = logInInfo[4].toString();
  
      Long rowInserted = patientTreatmentOfDischargeSql
              .addPatientDischargeValue(btnYesM, editorValueM,
                      patientAdmissionNo, regNoM, specializationInt,
                      doctorEmpId, companyNo, doctorEmpId, date, rate_valueM,
                      referredToM);
  
      if (btnYesM.equals("0") || btnYesM.equals("1")) {
          deschargeInfo.setBtnSave(false);
          deschargeInfo.setBtnSaveAsDruft(false);
          deschargeInfo.setBtnResumeOnDraft(false);
      } else {
  
          deschargeInfo.setBtnSave(false);
          deschargeInfo.setBtnSaveAsDruft(false);
          deschargeInfo.setBtnResumeOnDraft(true);
      }
      return "saveEditorValueAsTemplate";
  }
  </code></pre>
  
  <p><strong>My SQL Code is</strong> </p>
  
  <pre><code>public Long addPatientDischargeValue(String CRITICAL_FLAG , String DISCHARGE_TEXT ,String ADMISSION_NO , String REG_NO ,Integer specialization_no,String ENTERED_BY, String COMPANY_NO, String UPDATE_BY, Date UPDATED_TIMESTAMP,String mode_of_discharge, String referred_to) {
      Long rowInserted=(long) 0;
  
      boolean fg = true;
      con = dbc.connectDB();
  
      if (con == null) {
          fg = false;
      }
      if (fg) {
          try {
              st = con.createStatement();
              String countQry = "SELECT COUNT(ADMISSION_NO) COUNT FROM IP_DISCHARGE WHERE ADMISSION_NO='"
                      + ADMISSION_NO + "'";
  
              int countNo= 0;
              ResultSet rsCount=st.executeQuery(countQry);
              if(rsCount.next()){
                  countNo = rsCount.getInt("COUNT");
              }
  
              String insertUpdate = null;
  
              if (countNo &gt; 0) {
  
                  insertUpdate="update ip_discharge set " +
                          " update_by    ='"+UPDATE_BY+"', " +
                          " updated_timestamp      = sysdate, " +                             
                          "  critical_flag  = '" + CRITICAL_FLAG + "' ," +
                          "  discharge_text = '" + DISCHARGE_TEXT + "', " +
                          "  mode_of_discharge = '" + mode_of_discharge + "', " +
                          "  referred_to       = '" + referred_to + "' " +
                          " where " +
                          " admission_no = '"+ ADMISSION_NO+ "'";
  
  
              } else {
                  String PK_NO = generatedSequence("",
                          "SEQ_PATTYPEDTL", "D", "1", "Y");
                  insertUpdate = "INSERT INTO ip_discharge (DISCHARGE_ID,ADMISSION_NO , reg_no, DISCHARGE_TEXT , specialization_no , CRITICAL_FLAG , ENTERED_BY , COMPANY_NO, mode_of_discharge, referred_to "
                          + ")values('"+ PK_NO+ "','"+ ADMISSION_NO+ "','"+ REG_NO+ "','" + DISCHARGE_TEXT + "'," + specialization_no + ",'" + CRITICAL_FLAG + "','" + ENTERED_BY + "','" + COMPANY_NO + "','" + mode_of_discharge + "','" + referred_to + "')";
              }
              System.out.println(insertUpdate);
              st.executeUpdate(insertUpdate);
          } catch (Exception ex) {
              ex.printStackTrace();
          } finally {
              try {
                  st.close();
                  con.close();
              } catch (SQLException ex) {
                  ex.printStackTrace();
              }
          }
      }
  
      return rowInserted;
  }
  </code></pre>
  
  <p><strong>my table data Type is</strong> </p>
  
  <pre><code>CREATE TABLE IP_DISCHARGE
  (
    DISCHARGE_ID       VARCHAR2(16 BYTE),
    ADMISSION_NO       VARCHAR2(16 BYTE)          NOT NULL,
    ENTERED_BY         VARCHAR2(16 BYTE),
    ENTRY_TIMESTAMP    DATE                       DEFAULT SYSDATE,
    UPDATE_BY          VARCHAR2(16 BYTE),
    UPDATED_TIMESTAMP  DATE,
    COMPANY_NO         VARCHAR2(10 BYTE),
    DEPT_NO            NUMBER,
    CRITICAL_FLAG      VARCHAR2(1 BYTE),
    DISCHARGE_TEXT     CLOB,
    REG_NO             VARCHAR2(22 BYTE),
    MODE_OF_DISCHARGE  VARCHAR2(22 BYTE),
    REFERRED_TO        VARCHAR2(22 BYTE),
    SPECIALIZATION_NO  NUMBER
  )
  </code></pre>